Leaked source code of windows server 2003
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.

155 lines
3.4 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. #ifndef LOGGING_DLLEXP
  15. # ifdef DLL_IMPLEMENTATION
  16. # define LOGGING_DLLEXP __declspec(dllexport)
  17. # ifdef IMPLEMENTATION_EXPORT
  18. # define LOGGING_EXPIMP
  19. # else
  20. # undef LOGGING_EXPIMP
  21. # endif
  22. # elif defined LIB_IMPLEMENTATION
  23. # define LOGGING_DLLEXP
  24. # define LOGGING_EXPIMP extern
  25. # else
  26. # define LOGGING_DLLEXP __declspec(dllimport)
  27. # define LOGGING_EXPIMP extern
  28. # endif // !DLL_IMPLEMENTATION
  29. #endif // !LOGGING_DLLEXP
  30. enum LAST_IO_PENDING
  31. {
  32. LOG_READ_IO,
  33. LOG_WRITE_IO,
  34. LOG_NO_IO
  35. };
  36. class LOG_CONTEXT
  37. {
  38. public:
  39. LOG_CONTEXT()
  40. : m_msStartTickCount (0),
  41. m_msProcessingTime (0),
  42. m_dwBytesRecvd (0),
  43. m_dwBytesSent (0),
  44. m_ioPending (LOG_NO_IO),
  45. m_strLogParam (m_achLogParam, sizeof m_achLogParam)
  46. {
  47. ZeroMemory(&m_UlLogData, sizeof m_UlLogData);
  48. }
  49. HTTP_LOG_FIELDS_DATA *QueryUlLogData()
  50. {
  51. return &m_UlLogData;
  52. }
  53. //
  54. // The querystring to be logged, may differ from the original querystring
  55. // because of ISAPI doing HSE_APPEND_LOG_PARAMETER
  56. //
  57. STRA m_strLogParam;
  58. CHAR m_achLogParam[64];
  59. //
  60. // The data UL is interested in
  61. //
  62. HTTP_LOG_FIELDS_DATA m_UlLogData;
  63. //
  64. // Couple other things for custom logging
  65. //
  66. STRA m_strVersion;
  67. MULTISZA m_mszHTTPHeaders;
  68. //
  69. // Keep track whether the last I/O was a read or a write so that we
  70. // know on completion whether to increment bytes read or bytes written
  71. //
  72. LAST_IO_PENDING m_ioPending;
  73. DWORD m_msStartTickCount;
  74. DWORD m_msProcessingTime;
  75. DWORD m_dwBytesRecvd;
  76. DWORD m_dwBytesSent;
  77. };
  78. class LOGGING_DLLEXP LOGGING
  79. {
  80. public:
  81. LOGGING();
  82. HRESULT ActivateLogging(IN LPCSTR pszInstanceName,
  83. IN LPCWSTR pszMetabasePath,
  84. IN IMSAdminBase *pMDObject,
  85. IN BOOL fDoCentralBinaryLogging);
  86. void LogInformation(IN LOG_CONTEXT *pLogData);
  87. BOOL IsRequiredExtraLoggingFields() const
  88. {
  89. return !m_mszExtraLoggingFields.IsEmpty();
  90. }
  91. const MULTISZA *QueryExtraLoggingFields() const
  92. {
  93. return &m_mszExtraLoggingFields;
  94. }
  95. void LogCustomInformation(IN DWORD cCount,
  96. IN CUSTOM_LOG_DATA *pCustomLogData,
  97. IN LPSTR szHeaderSuffix);
  98. static HRESULT Initialize();
  99. static VOID Terminate();
  100. BOOL QueryDoUlLogging() const
  101. {
  102. return m_fUlLogType;
  103. }
  104. BOOL QueryDoCustomLogging() const
  105. {
  106. return (m_pComponent != NULL);
  107. }
  108. VOID AddRef();
  109. VOID Release();
  110. private:
  111. ~LOGGING();
  112. DWORD m_Signature;
  113. LONG m_cRefs;
  114. BOOL m_fUlLogType;
  115. ILogPlugin *m_pComponent;
  116. MULTISZA m_mszExtraLoggingFields;
  117. };
  118. #endif // _LOGGING_H_