You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
811 B

  1. #pragma once
  2. #include <iostream>
  3. #include <string>
  4. struct print {
  5. print() {}
  6. ~print() { std::cout << std::endl; }
  7. };
  8. struct noprint {
  9. noprint() { std::cout.setstate(std::ios_base::failbit); }
  10. ~noprint() { std::cout.clear(); }
  11. };
  12. #ifdef LOG_DEBUG
  13. #define DEBUG (print(), std::cout << "DEBUG[" << __FILENAME__ << ":" << __LINE__ << " in " << __func__ << "()]: ")
  14. #define WARN (print(), std::cout << "WARN [" << __FILENAME__ << ":" << __LINE__ << " in " << __func__ << "()]: ")
  15. #else
  16. #define DEBUG (noprint(), std::cout << "")
  17. #define WARN (noprint(), std::cout << "")
  18. #endif
  19. #ifdef LOG_DEBUG
  20. #define STEP \
  21. do { DEBUG << "Stepping through, Hit Enter..."; \
  22. std::cin.get(); \
  23. } while (0)
  24. #else
  25. #define STEP (void)(0)
  26. #endif
  27. namespace io {
  28. void debug(std::string msg);
  29. }