Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
2.7 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1997.
  5. //
  6. // File: ntlog.hxx
  7. //
  8. // Contents: encapsulate ntlog
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // Notes:
  15. //
  16. // History: 8-23-96 benl Created
  17. //
  18. //----------------------------------------------------------------------------
  19. #ifndef _CNTLOG
  20. #define _CNTLOG
  21. #include "log.hxx"
  22. //+---------------------------------------------------------------------------
  23. //
  24. // Class: CNtLog
  25. //
  26. // Purpose: Implement logging via NTLOG
  27. //
  28. // Interface: CNtLog --
  29. // ~CNtLog --
  30. // Init --
  31. // Error --
  32. // Warn --
  33. // Info --
  34. // Pass --
  35. // Fail --
  36. // Close --
  37. // AttachThread --
  38. // DetachThread --
  39. // StartVariation --
  40. // EndVariation --
  41. // _hLog --
  42. // _lpName --
  43. // _dwLevel --
  44. //
  45. // History: 9-18-1997 benl Created
  46. //
  47. // Notes:
  48. //
  49. //----------------------------------------------------------------------------
  50. class CNtLog : public CLog {
  51. public:
  52. CNtLog();
  53. virtual ~CNtLog();
  54. virtual BOOL Init( LPCTSTR lpLogFile);
  55. virtual VOID Error( LPCTSTR fmt, ...);
  56. virtual VOID Warn( LPCTSTR fmt, ...);
  57. virtual VOID Info( LPCTSTR fmt, ...);
  58. virtual VOID Pass( LPCTSTR fmt, ...);
  59. virtual VOID Fail( LPCTSTR fmt, ...);
  60. virtual VOID Close( BOOL bDelete = FALSE);
  61. virtual VOID AttachThread();
  62. virtual VOID DetachThread();
  63. virtual VOID StartVariation();
  64. virtual VOID EndVariation();
  65. private:
  66. HANDLE _hLog;
  67. TCHAR _lpName[MAX_PATH];
  68. DWORD _dwLevel;
  69. };
  70. //inlines
  71. //+---------------------------------------------------------------------------
  72. //
  73. // Member: CNtLog::CNtLog
  74. //
  75. // Synopsis:
  76. //
  77. // Arguments: (none)
  78. //
  79. // Returns:
  80. //
  81. // History: 8-23-96 benl Created
  82. //
  83. // Notes:
  84. //
  85. //----------------------------------------------------------------------------
  86. inline CNtLog::CNtLog()
  87. {
  88. _hLog = NULL;
  89. _lpName[0] = _T('\0');
  90. } //CNtLog::CNtLog
  91. //+---------------------------------------------------------------------------
  92. //
  93. // Member: CNtLog::~CNtLog
  94. //
  95. // Synopsis: Close things up if there's an active handle
  96. //
  97. // Arguments: (none)
  98. //
  99. // Returns:
  100. //
  101. // History: 8-23-96 benl Created
  102. //
  103. // Notes:
  104. //
  105. //----------------------------------------------------------------------------
  106. inline CNtLog::~CNtLog()
  107. {
  108. if (_hLog) {
  109. Close();
  110. }
  111. } //CNtLog::~CNtLog
  112. #endif
  113.