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.

77 lines
1.8 KiB

  1. //
  2. // MODULE: APGTSLOG.H
  3. //
  4. // PURPOSE: User Activity Logging Utility
  5. // Fully implements class CHTMLLog
  6. //
  7. // PROJECT: Generic Troubleshooter DLL for Microsoft AnswerPoint
  8. //
  9. // COMPANY: Saltmine Creative, Inc. (206)-284-7511 [email protected]
  10. //
  11. // AUTHOR: Roman Mach
  12. //
  13. // ORIGINAL DATE: 8-2-96
  14. //
  15. // NOTES:
  16. // 1. Based on Print Troubleshooter DLL
  17. //
  18. // Version Date By Comments
  19. //--------------------------------------------------------------------
  20. // V0.1 - RM Original
  21. // V3.0 9/21/98 JM Pulled into separate file
  22. //
  23. #ifndef _H_APGTSLOG
  24. #define _H_APGTSLOG
  25. #include "apgtsstr.h"
  26. #define LOGFILEPREFACE _T("gt")
  27. #define MAXLOGSBEFOREFLUSH 5
  28. #define MAXLOGSIZE 1000
  29. class CPoolQueue;
  30. //
  31. //
  32. class CHTMLLog
  33. {
  34. public:
  35. static void SetUseLog(bool bUseLog);
  36. public:
  37. CHTMLLog(const TCHAR *);
  38. ~CHTMLLog();
  39. DWORD NewLog(LPCTSTR data);
  40. DWORD GetStatus();
  41. // Access function to enable the registry monitor to change the logging file directory.
  42. void SetLogDirectory( const CString &strNewLogDir );
  43. // testing only
  44. DWORD WriteTestLog(LPCTSTR szAPIName, DWORD dwThreadID);
  45. protected:
  46. DWORD FlushLogs();
  47. void Lock();
  48. void Unlock();
  49. protected:
  50. static bool s_bUseHTMLLog;
  51. protected:
  52. CRITICAL_SECTION m_csLogLock; // must lock to write to log file
  53. CString *m_buffer[MAXLOGSBEFOREFLUSH]; // Array of separate strings to log, held here
  54. // till we flush
  55. // Note this is our CString, not MFC - 10/97
  56. UINT m_bufindex; // index into m_buffer, next slot to write to.
  57. // incremented after writing; when it reaches
  58. // MAXLOGSBEFOREFLUSH, we flush
  59. DWORD m_dwErr; // Latest error. NOTE: once this is set nonzero, it
  60. // can never be cleared & logging is effectively
  61. // disabled.
  62. CString m_strDirPath; // directory in which we write log files.
  63. };
  64. #endif // _H_APGTSLOG