Log4CPP.TLSLog.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #pragma once
  2. #include <string>
  3. #ifdef Log4CPP_TLSLog_EXPORTS
  4. #define __Log4CPP_TLSLog_API _declspec(dllexport)
  5. #else
  6. #define __Log4CPP_TLSLog_API _declspec(dllimport)
  7. #endif
  8. //-----------------------------------------------------------------------------
  9. // Log4CPP::Context
  10. //-----------------------------------------------------------------------------
  11. namespace Log4CPP
  12. {
  13. namespace ThreadContext
  14. {
  15. //-----------------------------------------------------------------------------
  16. // TLSMessage
  17. //-----------------------------------------------------------------------------
  18. class __Log4CPP_TLSLog_API TLSMessage
  19. {
  20. protected:
  21. TLSMessage () = delete;
  22. public:
  23. static char * Get ();
  24. static int Size ();
  25. };
  26. //-----------------------------------------------------------------------------
  27. // TLSLayout
  28. //-----------------------------------------------------------------------------
  29. class __Log4CPP_TLSLog_API TLSLayout
  30. {
  31. protected:
  32. TLSLayout () = delete;
  33. public:
  34. static char * Get ();
  35. static int Size ();
  36. };
  37. #if 0
  38. //-----------------------------------------------------------------------------
  39. // ThreadName
  40. // 在异步缓存时, 线程名称没法转移
  41. //-----------------------------------------------------------------------------
  42. class __Log4CPP_TLSLog_API ThreadName
  43. {
  44. protected:
  45. ThreadName () = delete;
  46. public:
  47. static const char * Get ();
  48. static void Set (const char * Name);
  49. };
  50. #endif
  51. //-----------------------------------------------------------------------------
  52. // ThreadName
  53. // 仅供 Log4CPP 内部使用, 避免跟调用者的 Buffer 混淆
  54. //-----------------------------------------------------------------------------
  55. class __Log4CPP_TLSLog_API TLSInternal
  56. {
  57. protected:
  58. TLSInternal () = delete;
  59. public:
  60. static char * Get ();
  61. static int Size ();
  62. };
  63. }
  64. };