如何使用Pantheios向Windows事件日誌發送日誌消息?使用Pantheios日誌庫記錄到Windows事件
和
如果我使用Pantheious多個過程做到這一點,纔有過程 安全嗎?我會得到craches嗎?
如何使用Pantheios向Windows事件日誌發送日誌消息?使用Pantheios日誌庫記錄到Windows事件
和
如果我使用Pantheious多個過程做到這一點,纔有過程 安全嗎?我會得到craches嗎?
使用be.WindowsEventLog。
不,我不這麼認爲,比你從多個進程中使用事件日誌還要多。
你需要做到以下幾點:
您需要be.WindowsEventLog鏈接。
在Windows上,可以通過向其中一個編譯單元添加#include <pantheios/implicit_link/be.WindowsEventLog.h>
來實現隱式鏈接。
此外,您必須定義應用程序特定功能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;
}
category
和eventID
的文檔可分別在MSDN Event Logging docshere和here上找到。