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.

151 lines
6.3 KiB

  1. /*++
  2. 1998 Seagate Software, Inc. All rights reserved.
  3. Module Name:
  4. WsbTrc.h
  5. Abstract:
  6. This header file defines the part of the platform code that is
  7. responsible for function tracing.
  8. Author:
  9. Chuck Bardeen [cbardeen] 29-Oct-1996
  10. Revision History:
  11. Brian Dodd [brian] 09-May-1996 - Added event logging
  12. --*/
  13. #ifndef _WSBTRC_
  14. #define _WSBTRC_
  15. #include "wsb.h"
  16. #include "resource.h"
  17. //Registry strings for trace settings
  18. #define WSB_TRACE_COUNT OLESTR("WsbTraceCount")
  19. #define WSB_TRACE_TIMESTAMP OLESTR("WsbTraceTimestamp")
  20. #define WSB_TRACE_THREADID OLESTR("WsbTraceThreadId")
  21. #define WSB_TRACE_ON OLESTR("WsbTraceOn")
  22. #define WSB_TRACE_TO_DEBUG OLESTR("WsbTraceToDebug")
  23. #define WSB_TRACE_TO_STDOUT OLESTR("WsbTraceToStdOut")
  24. #define WSB_TRACE_TO_FILE OLESTR("WsbTraceToFile")
  25. #define WSB_TRACE_FILE_NAME OLESTR("WsbTraceFileName")
  26. #define WSB_TRACE_FILE_MAX_SIZE OLESTR("WsbTraceFileMaxSize")
  27. #define WSB_TRACE_FILE_COMMIT OLESTR("WsbTraceFileCommit")
  28. #define WSB_TRACE_ENTRY_EXIT OLESTR("WsbTraceEntryExit")
  29. #define WSB_TRACE_FILE_COPY_NAME OLESTR("WsbTraceFileCopyName")
  30. #define WSB_LOG_LEVEL OLESTR("WsbLogLevel")
  31. #define WSB_LOG_SNAP_SHOT_ON OLESTR("WsbLogSnapShotOn")
  32. #define WSB_LOG_SNAP_SHOT_LEVEL OLESTR("WsbLogSnapShotLevel")
  33. #define WSB_LOG_SNAP_SHOT_PATH OLESTR("WsbLogSnapShotPath")
  34. #define WSB_LOG_SNAP_SHOT_RESET_TRACE OLESTR("WsbLogSnapShotResetTrace")
  35. #define WSB_TRACE_DO_PLATFORM OLESTR("WsbTraceDoPlatform")
  36. #define WSB_TRACE_DO_RMS OLESTR("WsbTraceDoRms")
  37. #define WSB_TRACE_DO_SEG OLESTR("WsbTraceDoSeg")
  38. #define WSB_TRACE_DO_META OLESTR("WsbTraceDoMeta")
  39. #define WSB_TRACE_DO_HSMENG OLESTR("WsbTraceDoHsmEng")
  40. #define WSB_TRACE_DO_JOB OLESTR("WsbTraceDoJob")
  41. #define WSB_TRACE_DO_HSMTSKMGR OLESTR("WsbTraceDoHsmTskMgr")
  42. #define WSB_TRACE_DO_FSA OLESTR("WsbTraceDoFsa")
  43. #define WSB_TRACE_DO_DATAMIGRATER OLESTR("WsbTraceDoDatamigrater")
  44. #define WSB_TRACE_DO_DATARECALLER OLESTR("WsbTraceDoDataRecaller")
  45. #define WSB_TRACE_DO_DATAVERIFIER OLESTR("WsbTraceDoDataVerifier")
  46. #define WSB_TRACE_DO_UI OLESTR("WsbTraceDoUI")
  47. #define WSB_TRACE_DO_DATAMOVER OLESTR("WsbTraceDoDataMover")
  48. #define WSB_TRACE_DO_HSMCONN OLESTR("WsbTraceDoHsmConn")
  49. #define WSB_TRACE_DO_IDB OLESTR("WsbTraceDoIDB")
  50. #define WSB_TRACE_DO_COPYMEDIA OLESTR("WsbTraceDoCopyMedia")
  51. #define WSB_TRACE_DO_PERSISTENCE OLESTR("WsbTraceDoPersistence")
  52. #define WSB_TRACE_DO_HSMSERV OLESTR("WsbTraceDoHsmServ")
  53. class CWsbTrace :
  54. public IWsbTrace,
  55. public CComObjectRoot,
  56. public CComCoClass<CWsbTrace,&CLSID_CWsbTrace>
  57. {
  58. public:
  59. CWsbTrace() {}
  60. BEGIN_COM_MAP( CWsbTrace )
  61. COM_INTERFACE_ENTRY( IWsbTrace )
  62. END_COM_MAP( )
  63. DECLARE_REGISTRY_RESOURCEID( IDR_CWsbTrace )
  64. HRESULT FinalConstruct( void );
  65. void FinalRelease( void );
  66. // IWsbTrace
  67. public:
  68. STDMETHOD( StartTrace )( void );
  69. STDMETHOD( StopTrace )( void );
  70. STDMETHOD( SetTraceOn )( LONGLONG traceElement );
  71. STDMETHOD( SetTraceOff )( LONGLONG traceElement );
  72. STDMETHOD( GetTraceSettings )( LONGLONG *pTraceElements );
  73. STDMETHOD( GetTraceSetting )( LONGLONG traceElement, BOOL *pOn );
  74. STDMETHOD( SetTraceFileControls )( OLECHAR *pTraceFileName,
  75. BOOL commitEachEntry, LONGLONG maxTraceFileSize,
  76. OLECHAR *pTraceFileCopyName);
  77. STDMETHOD( GetTraceFileControls )( OLECHAR **ppTraceFileName,
  78. BOOL *pCommitEachEntry, LONGLONG *pMaxTraceFileSize,
  79. OLECHAR **ppTraceFileCopyName);
  80. STDMETHOD( DirectOutput )(ULONG output );
  81. STDMETHOD( SetOutputFormat )( BOOL timeStamp, BOOL traceCount, BOOL threadId );
  82. STDMETHOD( GetOutputFormat )( BOOL *pTimeStamp, BOOL *pTraceCount, BOOL *pThreadId );
  83. STDMETHOD( SetTraceEntryExit )( BOOL traceEntryExit );
  84. STDMETHOD( GetTraceEntryExit )( BOOL *pTraceEntryExit );
  85. STDMETHOD( SetLogLevel )( WORD logLevel );
  86. STDMETHOD( SetLogSnapShot)( BOOL on, WORD level, OLECHAR *snapShotPath, BOOL resetTrace);
  87. STDMETHOD( GetLogSnapShot)( BOOL *pOn, WORD *pLevel, OLECHAR **pSnapShotPath, BOOL *pResetTrace);
  88. STDMETHOD( GetLogLevel )( WORD *pLogLevel );
  89. STDMETHOD( GetRegistryEntry )( OLECHAR **pTraceRegistrySetting );
  90. STDMETHOD( SetRegistryEntry )( OLECHAR *traceRegistrySetting );
  91. STDMETHOD( LoadFromRegistry )( void );
  92. STDMETHOD( SetTraceSettings )( LONGLONG traceElements );
  93. STDMETHOD( Print )(OLECHAR* traceString );
  94. protected:
  95. // Helper functions
  96. STDMETHOD( AdjustFileNames )( void );
  97. STDMETHOD( WrapTraceFile )( void );
  98. STDMETHOD( LoadFileSettings )( void );
  99. STDMETHOD( LoadTraceSettings )( void );
  100. STDMETHOD( LoadOutputDestinations )( void );
  101. STDMETHOD( LoadFormat )( void );
  102. STDMETHOD( LoadStart )( void );
  103. STDMETHOD( Write )(OLECHAR* pString );
  104. BOOL m_TraceOn;
  105. LONGLONG m_TraceSettings;
  106. CWsbStringPtr m_TraceFileName;
  107. ULONG m_TraceOutput;
  108. BOOL m_CommitEachEntry;
  109. BOOL m_TimeStamp;
  110. BOOL m_TraceCount;
  111. BOOL m_TraceThreadId;
  112. BOOL m_TraceEntryExit;
  113. WORD m_LogLevel;
  114. LONGLONG m_MaxTraceFileSize;
  115. HANDLE m_TraceFilePointer;
  116. BOOL m_WrapMode;
  117. CWsbStringPtr m_RegistrySetting;
  118. CWsbStringPtr m_TraceFileCopyName;
  119. CWsbStringPtr m_TraceMultipleFilePattern; // printf style pattern
  120. ULONG m_TraceMultipleFileCount; // count inserted into pattern
  121. CWsbStringPtr m_TraceFileDir; // directory for trace file
  122. CWsbStringPtr m_TraceFileCopyDir; // directory for trace file copy
  123. HANDLE m_TraceCountHandle;
  124. PLONG m_pTraceCountGlobal;
  125. };
  126. #endif // _WSBTRC_