Novalis
Novalis

Reputation: 2325

Logging to windows event using Pantheios logging library

How can i send log messages to windows event log using Pantheios?

and

If i do it from multiple process using Pantheious , will it be process safe? Will i get craches?

Upvotes: 0

Views: 163

Answers (2)

Adi Shavit
Adi Shavit

Reputation: 17285

You need to do the following:

  1. You need to link with be.WindowsEventLog.
    On Windows this can be done with implicit linking by adding #include <pantheios/implicit_link/be.WindowsEventLog.h> to one of your compilation units.

  2. Also, you must define the application specific function pantheios_be_WindowsEventLog_calcCategoryAndEventId() (as specified in the tiny note in the docs: Note This is an application-specified function..

An example, bare-simple implementation can be found in pantheios-folder\test\scratch\test.scratch.api\test.scratch.api.cpp:

//  The following allows this to be used with the Windows EventLog back-end.
PANTHEIOS_CALL(void) pantheios_be_WindowsEventLog_calcCategoryAndEventId(
    int                     /* backEndId */
,   int                     /* severity */
,   pantheios::uint16_t*    category 
,   pantheios::uint32_t*    eventId
) /* throw() */
{

   // NOTE: A proper implementation would specify non-0 values here that
   // identify the requisite event identifier and category within the
   // associated message file(s).

   *eventId    =   0;
   *category   =   0;
}

Documentation for category and eventID can be found on the MSDN Event Logging docs here and here respectively.

Upvotes: 3

dcw
dcw

Reputation: 3565

  1. Use be.WindowsEventLog.

  2. No, I don't believe so, any more than you would using Event Log from multiple processes.

Upvotes: 0

Related Questions