Main Page | Data Structures | File List | Data Fields | Globals

msgs.h File Reference


Detailed Description

MC generates msgs.h from the example msgs.mc for logged messages.

The Format language is introduced with

LanguageNames=( English=0x0409:MSG_EN Format=0x0444:MSG_FMT )
You may insert any further language you want, but 0x444 is the one that log_init() loads to retrieve machine readable formats. See In a nutshell for an example.

A category is an attribute of a reported event. The categories must be numbered consecutively, beginning with the number 1. Use categories to classify your messages for improved readability.

Reserve the numbers until, say, 1000 for categories. That gap is necessary to ensure that categories form their own index entry in the binary resource header. That way the number of categories, needed for source registration, can be determined at runtime.

The facility is part of a message id: combined with the severity it constitutes the high word of the message id. You may use different facilities to let messages being defined by different programmers. Otherwise, you may initialize a log_event_data so as to automatically set category == facility in the reported events.

Here is a simple example of a real life .mc file:

;#include <windows.h> ;#include <w32event.h> ; ;// global application log ;extern log_event_data the_application_log; ;#define APP_LOG (&the_application_log) ;#define APP_LOG_NAME "my_name" ;#define APP_LOG_DEFINE log_event_data the_application_log ; ;// macro to report MEMORY_FAILURE ;#define REPORT_MEMORY_FAILURE(REQ_SIZE) do { \ ; unsigned const the_requested_size = (REQ_SIZE); \ ; ReportEvent(the_application_log.log, \ ; EVENTLOG_ERROR_TYPE, PROCESS_MESSAGES, MEMORY_FAILURE, \ ; the_application_log.sid, 0, \ ; sizeof the_requested_size, NULL, &the_requested_size); \ ;} while (0)

See also:
v_log_event()

log_init()


Generated on Mon Apr 11 14:47:59 2005 for LogEvent by doxygen 1.3.7