CmDebug.h 861 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #pragma once
  2. #include "CmPrerequisitesUtil.h"
  3. #include "CmLog.h"
  4. namespace CamelotEngine
  5. {
  6. class Log;
  7. class CM_UTILITY_EXPORT Debug
  8. {
  9. public:
  10. void logDebug(std::string msg);
  11. void logInfo(std::string msg);
  12. void logWarning(std::string msg);
  13. void logError(std::string msg);
  14. void log(const String& msg, const String& channel);
  15. Log& getLog() { return mLog; }
  16. private:
  17. Log mLog;
  18. };
  19. CM_UTILITY_EXPORT Debug& gDebug();
  20. template <typename T>
  21. std::string toStr(T number)
  22. {
  23. std::ostringstream ss;
  24. ss << number;
  25. return ss.str();
  26. }
  27. #define LOGDBG(x) CamelotEngine::gDebug().logDebug((x));
  28. #define LOGINFO(x) CamelotEngine::gDebug().logInfo((x));
  29. #define LOGWRN(x) CamelotEngine::gDebug().logWarning((x));
  30. #define LOGERR(x) CamelotEngine::gDebug().logError((x));
  31. #define CM_ASSERT(x) assert(x)
  32. }