NullLog.hpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #pragma once
  2. #include <string>
  3. #define __LOG__NullLog__
  4. //-----------------------------------------------------------------------------
  5. // 定义一个全空的日志类, 某些模块可能不想要任何日志
  6. //-----------------------------------------------------------------------------
  7. namespace ECOM
  8. {
  9. namespace NullLog
  10. {
  11. // 无格式输出, 直接刷盘
  12. inline void Flush (const char * str) {}
  13. inline void Flush (const char * str, int) {}
  14. inline void NewLine () {}
  15. template <typename... Args>
  16. void Log (const char * format, Args && ... args)
  17. {
  18. }
  19. template <typename... Args>
  20. void Force (const char * format, Args && ... args)
  21. {
  22. }
  23. template <typename... Args>
  24. void Info (const char * format, Args && ... args)
  25. {
  26. }
  27. template <typename... Args>
  28. void Notice (const char * format, Args && ... args)
  29. {
  30. }
  31. template <typename... Args>
  32. void Warning (const char * format, Args && ... args)
  33. {
  34. }
  35. template <typename... Args>
  36. void Warn (const char * format, Args && ... args)
  37. {
  38. }
  39. template <typename... Args>
  40. void Error (const char * format, Args && ... args)
  41. {
  42. }
  43. template <typename... Args>
  44. void Fatal (const char * format, Args && ... args)
  45. {
  46. }
  47. template <typename... Args>
  48. void Log (const std::string & format, Args && ... args)
  49. {
  50. }
  51. template <typename... Args>
  52. void Info (const std::string & format, Args && ... args)
  53. {
  54. }
  55. template <typename... Args>
  56. void Warning (const std::string & format, Args && ... args)
  57. {
  58. }
  59. template <typename... Args>
  60. void Error (const std::string & format, Args && ... args)
  61. {
  62. }
  63. template <typename... Args>
  64. void Fatal (const std::string & format, Args && ... args)
  65. {
  66. }
  67. static std::string ErrorCodeToString (DWORD errorCode)
  68. {
  69. return std::string ();
  70. }
  71. static void Close ()
  72. {
  73. }
  74. }
  75. }
  76. namespace mLog = ECOM::NullLog;