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.

102 lines
3.4 KiB

  1. /*++ BUILD Version: 0001 // Increment this if a change has global effects
  2. Copyright (c) 2000-2001 Microsoft Corporation
  3. Module Name:
  4. perfmsg.h
  5. Abstract:
  6. This file provides the macros and definitions used by the extensible
  7. counters for reporting events to the event logging facility
  8. Author:
  9. davj 17-May-2000
  10. Revision History:
  11. --*/
  12. #ifndef _PERFMSG_H_
  13. #define _PERFMSG_H_
  14. //
  15. // Report error message ID's for Counters
  16. //
  17. //
  18. // The constant below defines how many (if any) messages will be reported
  19. // to the event logger. As the number goes up in value more and more events
  20. // will be reported. The purpose of this is to allow lots of messages during
  21. // development and debugging (e.g. a message level of 3) to a minimum of
  22. // messages (e.g. operational messages with a level of 1) or no messages if
  23. // message logging inflicts too much of a performance penalty. Right now
  24. // this is a compile time constant, but could later become a registry entry.
  25. //
  26. // Levels: LOG_NONE = No event log messages ever
  27. // LOG_ERROR = User event log messages (e.g. errors)
  28. // LOG_VERBOSE = Max messages
  29. //
  30. #define LOG_NONE 0
  31. #define LOG_ERROR 1
  32. #define LOG_VERBOSE 2
  33. #define MESSAGE_LEVEL_DEFAULT LOG_ERROR
  34. // define macros
  35. //
  36. // Format for event log calls without corresponding insertion strings is:
  37. // REPORT_xxx (message_value, message_level)
  38. // where:
  39. // xxx is the severity to be displayed in the event log
  40. // message_value is the numeric ID from above
  41. // message_level is the "filtering" level of error reporting
  42. // using the error levels above.
  43. //
  44. // if the message has a corresponding insertion string whose symbol conforms
  45. // to the format CONSTANT = numeric value and CONSTANT_S = string constant for
  46. // that message, then the
  47. //
  48. // REPORT_xxx_STRING (message_value, message_level)
  49. //
  50. // macro may be used.
  51. //
  52. //
  53. // REPORT_SUCCESS was intended to show Success in the error log, rather it
  54. // shows "N/A" so for now it's the same as information, though it could
  55. // (should) be changed in the future
  56. //
  57. #define REPORT_SUCCESS(i,l) (MESSAGE_LEVEL >= l ? ReportEvent (hEventLog, EVENTLOG_INFORMATION_TYPE, \
  58. 0, i, (PSID)NULL, 0, 0, NULL, (PVOID)NULL) : FALSE)
  59. #define REPORT_INFORMATION(i,l) (MESSAGE_LEVEL >= l ? ReportEvent (hEventLog, EVENTLOG_INFORMATION_TYPE, \
  60. 0, i, (PSID)NULL, 0, 0, NULL, (PVOID)NULL) : FALSE)
  61. #define REPORT_WARNING(i,l) (MESSAGE_LEVEL >= l ? ReportEvent (hEventLog, EVENTLOG_WARNING_TYPE, \
  62. 0, i, (PSID)NULL, 0, 0, NULL, (PVOID)NULL) : FALSE)
  63. #define REPORT_ERROR(i,l) (MESSAGE_LEVEL >= l ? ReportEvent (hEventLog, EVENTLOG_ERROR_TYPE, \
  64. 0, i, (PSID)NULL, 0, 0, NULL, (PVOID)NULL) : FALSE)
  65. #define REPORT_INFORMATION_DATA(i,l,d,s) (MESSAGE_LEVEL >= l ? ReportEvent (hEventLog, EVENTLOG_INFORMATION_TYPE, \
  66. 0, i, (PSID)NULL, 0, s, NULL, (PVOID)(d)) : FALSE)
  67. #define REPORT_WARNING_DATA(i,l,d,s) (MESSAGE_LEVEL >= l ? ReportEvent (hEventLog, EVENTLOG_WARNING_TYPE, \
  68. 0, i, (PSID)NULL, 0, s, NULL, (PVOID)(d)) : FALSE)
  69. #define REPORT_ERROR_DATA(i,l,d,s) (MESSAGE_LEVEL >= l ? ReportEvent (hEventLog, EVENTLOG_ERROR_TYPE, \
  70. 0, i, (PSID)NULL, 0, s, NULL, (PVOID)(d)) : FALSE)
  71. // External Variables
  72. extern HANDLE hEventLog; // handle to event log
  73. extern DWORD dwLogUsers; // counter of event log using routines
  74. extern DWORD MESSAGE_LEVEL; // event logging detail level
  75. #endif //_PERFMSG_H_