Logger.temp.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #pragma once
  2. #include <windows.h>
  3. #ifdef _UNICODE
  4. #define DebugPrint DebugPrintW
  5. #else
  6. #define DebugPrint DebugPrintA
  7. #endif
  8. #include "DIOS.Dev.IODevice.hpp"
  9. using namespace DIOS::Dev;
  10. typedef enum _Log_Level {
  11. LOG_LEVEL_INIT,
  12. LOG_LEVEL_TRACE,
  13. LOG_LEVEL_DEBUG,
  14. LOG_LEVEL_INFO,
  15. LOG_LEVEL_WARNING,
  16. LOG_LEVEL_ERROR,
  17. LOG_LEVEL_FATAL,
  18. LOG_LEVEL_MAX
  19. }LOG_LEVEL;
  20. #define PRINTA_TRACE(format,...) __ReleasePrintA(LOG_LEVEL_TRACE,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  21. #define PRINTA_DEBUG(format,...) __ReleasePrintA(LOG_LEVEL_DEBUG,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  22. #define PRINTA_INFO(format,...) __ReleasePrintA(LOG_LEVEL_INFO,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  23. #define PRINTA_WARN(format,...) __ReleasePrintA(LOG_LEVEL_WARNING,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  24. #define PRINTA_ERROR(format,...) __ReleasePrintA(LOG_LEVEL_ERROR,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  25. #define PRINTA_FATAL(format,...) __ReleasePrintA(LOG_LEVEL_FATAL,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  26. void WINAPI CreateLogger(std::shared_ptr <DIOS::Dev::IOEventCenter> EventCenter);
  27. void WINAPI CreateLogger(std::string strLogName);
  28. void WINAPI ReleaseLogger();
  29. void __ReleasePrintA(
  30. LOG_LEVEL level,
  31. /*char* file,*/
  32. int line,
  33. char* function,
  34. char* format,
  35. ...
  36. );
  37. class TempLogger
  38. {
  39. public:
  40. TempLogger(std::shared_ptr <DIOS::Dev::IOEventCenter> EventCenter);
  41. ~TempLogger();
  42. std::shared_ptr <DIOS::Dev::IOEventCenter> g_EventCenter;
  43. HANDLE dump_Mutex;
  44. char* g_log_abuff = NULL;
  45. std::string GetTime();
  46. };