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.

93 lines
1.3 KiB

  1. /*
  2. * Copyright (c) 1998 Microsoft Corporation
  3. *
  4. * Module Name:
  5. *
  6. * logfile.h
  7. *
  8. * Abstract:
  9. *
  10. * This file contains code to log messages to a file.
  11. *
  12. * Author:
  13. *
  14. * Breen Hagan (BreenH) Oct-02-98
  15. *
  16. * Environment:
  17. *
  18. * User Mode
  19. */
  20. #ifndef _LSOC_LOGFILE_H_
  21. #define _LSOC_LOGFILE_H_
  22. /*
  23. * Constants.
  24. */
  25. #define CRLF "\r\n"
  26. /*
  27. * LogFile Class.
  28. */
  29. class LogFile
  30. {
  31. public:
  32. //
  33. // Constructor and destructor.
  34. //
  35. LogFile(
  36. );
  37. ~LogFile(
  38. );
  39. //
  40. // Standard functions.
  41. //
  42. VOID
  43. Close(
  44. VOID
  45. );
  46. DWORD
  47. Initialize(
  48. IN LPCTSTR pszLogFile,
  49. IN LPCTSTR pszLogModule
  50. );
  51. DWORD
  52. __cdecl
  53. LogMessage(
  54. LPCTSTR pszFormat,
  55. ...
  56. );
  57. private:
  58. BOOL m_fInitialized;
  59. HANDLE m_hFile;
  60. TCHAR m_szLogFile[MAX_PATH + 1];
  61. TCHAR m_szLogModule[MAX_PATH + 1];
  62. };
  63. //
  64. // The following permits a macro to reference a global variable for
  65. // the log file without putting the 'extern ...' line in each source
  66. // file. Because of this, however, logfile.h can not be included in
  67. // a precompiled header.
  68. //
  69. #ifndef _LSOC_LOGFILE_CPP_
  70. extern LogFile SetupLog;
  71. #endif
  72. #define LOGCLOSE SetupLog.Close
  73. #define LOGINIT(x, y) SetupLog.Initialize(x, y)
  74. #define LOGMESSAGE SetupLog.LogMessage
  75. #endif // _LSOC_LOGFILE_H_