2012-01-26 39 views

回答

0
  1. 使用be.WindowsEventLog。

  2. 不,我不這麼認爲,比你從多個進程中使用事件日誌還要多。

3

你需要做到以下幾點:

  1. 您需要be.WindowsEventLog鏈接。
    在Windows上,可以通過向其中一個編譯單元添加#include <pantheios/implicit_link/be.WindowsEventLog.h>來實現隱式鏈接。

  2. 此外,您必須定義應用程序特定功能pantheios_be_WindowsEventLog_calcCategoryAndEventId()(如微小記在docs規定:這是一個應用程序指定的功能

一個簡單實現的例子可以在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; 
} 

categoryeventID的文檔可分別在MSDN Event Logging docsherehere上找到。

相關問題