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.

105 lines
3.5 KiB

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