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.

137 lines
2.7 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name :
  4. logging.h
  5. Abstract:
  6. Logging classes
  7. Author:
  8. Anil Ruia (AnilR) 1-Jul-2000
  9. Environment:
  10. Win32 - User Mode
  11. --*/
  12. #ifndef _LOGGING_H_
  13. #define _LOGGING_H_
  14. enum LAST_IO_PENDING
  15. {
  16. LOG_READ_IO,
  17. LOG_WRITE_IO,
  18. LOG_NO_IO
  19. };
  20. class LOG_CONTEXT
  21. {
  22. public:
  23. LOG_CONTEXT()
  24. : m_msStartTickCount (0),
  25. m_msProcessingTime (0),
  26. m_dwBytesRecvd (0),
  27. m_dwBytesSent (0),
  28. m_ioPending (LOG_NO_IO),
  29. m_strLogParam (m_achLogParam, sizeof m_achLogParam)
  30. {
  31. ZeroMemory(&m_UlLogData, sizeof m_UlLogData);
  32. }
  33. HTTP_LOG_FIELDS_DATA *QueryUlLogData()
  34. {
  35. return &m_UlLogData;
  36. }
  37. //
  38. // The querystring to be logged, may differ from the original querystring
  39. // because of ISAPI doing HSE_APPEND_LOG_PARAMETER
  40. //
  41. STRA m_strLogParam;
  42. CHAR m_achLogParam[256];
  43. //
  44. // The data UL is interested in
  45. //
  46. HTTP_LOG_FIELDS_DATA m_UlLogData;
  47. //
  48. // Couple other things for custom logging
  49. //
  50. STRA m_strVersion;
  51. MULTISZA m_mszHTTPHeaders;
  52. //
  53. // Keep track whether the last I/O was a read or a write so that we
  54. // know on completion whether to increment bytes read or bytes written
  55. //
  56. LAST_IO_PENDING m_ioPending;
  57. DWORD m_msStartTickCount;
  58. DWORD m_msProcessingTime;
  59. DWORD m_dwBytesRecvd;
  60. DWORD m_dwBytesSent;
  61. };
  62. class dllexp LOGGING
  63. {
  64. public:
  65. LOGGING();
  66. HRESULT ActivateLogging(IN LPCSTR pszInstanceName,
  67. IN LPCWSTR pszMetabasePath,
  68. IN IMSAdminBase *pMDObject);
  69. void LogInformation(IN LOG_CONTEXT *pLogData);
  70. BOOL IsRequiredExtraLoggingFields() const
  71. {
  72. return !m_mszExtraLoggingFields.IsEmpty();
  73. }
  74. const MULTISZA *QueryExtraLoggingFields() const
  75. {
  76. return &m_mszExtraLoggingFields;
  77. }
  78. void LogCustomInformation(IN DWORD cCount,
  79. IN CUSTOM_LOG_DATA *pCustomLogData,
  80. IN LPSTR szHeaderSuffix);
  81. static HRESULT Initialize();
  82. static VOID Terminate();
  83. BOOL QueryDoUlLogging() const
  84. {
  85. return m_fUlLogType;
  86. }
  87. BOOL QueryDoCustomLogging() const
  88. {
  89. return (m_pComponent != NULL);
  90. }
  91. VOID AddRef();
  92. VOID Release();
  93. private:
  94. ~LOGGING();
  95. DWORD m_Signature;
  96. LONG m_cRefs;
  97. BOOL m_fUlLogType;
  98. ILogPlugin *m_pComponent;
  99. MULTISZA m_mszExtraLoggingFields;
  100. };
  101. #endif // _LOGGING_H_