SystemLogger.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #pragma once
  2. #ifndef DIOS_SYS_LOG_HEAD
  3. #define DIOS_SYS_LOG_HEAD
  4. #include <string>
  5. typedef enum _System_Log_Level {
  6. SYS_LOG_LEVEL_RESET,
  7. SYS_LOG_LEVEL_Trace,
  8. SYS_LOG_LEVEL_Debug,
  9. SYS_LOG_LEVEL_Information,
  10. SYS_LOG_LEVEL_Warning,
  11. SYS_LOG_LEVEL_Error,
  12. SYS_LOG_LEVEL_Fatal,
  13. SYS_LOG_LEVEL_Recoverable,
  14. SYS_LOG_LEVEL_Action,
  15. SYS_LOG_LEVEL_Telegram,
  16. SYS_LOG_LEVEL_Ortho,
  17. SYS_LOG_LEVEL_MAX
  18. }SYS_LOG_LEVEL;
  19. std::string SysLogLevel2str(int nlevel)
  20. {
  21. std::string out;
  22. switch (nlevel)
  23. {
  24. case SYS_LOG_LEVEL_RESET:
  25. out = "RESET";
  26. break;
  27. case SYS_LOG_LEVEL_Trace:
  28. out = "Trace";
  29. break;
  30. case SYS_LOG_LEVEL_Debug:
  31. out = "Debug";
  32. break;
  33. case SYS_LOG_LEVEL_Information:
  34. out = "Info";
  35. break;
  36. case SYS_LOG_LEVEL_Warning:
  37. out = "Warning";
  38. break;
  39. case SYS_LOG_LEVEL_Error:
  40. out = "Error";
  41. break;
  42. case SYS_LOG_LEVEL_Fatal:
  43. out = "Fatal";
  44. break;
  45. case SYS_LOG_LEVEL_Recoverable:
  46. out = "Recoverable";
  47. break;
  48. case SYS_LOG_LEVEL_Action:
  49. out = "Action";
  50. break;
  51. case SYS_LOG_LEVEL_Telegram:
  52. out = "Telegram";
  53. break;
  54. case SYS_LOG_LEVEL_Ortho:
  55. out = "Ortho";
  56. break;
  57. default:
  58. out = "";
  59. }
  60. return out;
  61. }
  62. #else
  63. #endif