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.

99 lines
3.5 KiB

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