-
Notifications
You must be signed in to change notification settings - Fork 3
Examples WindowsEventLogBackend
Eduard Mishkurov edited this page Jun 3, 2026
·
1 revision
This Windows-only example writes logme records to Windows Event Log.
The example creates a separate channel, attaches WindowsEventLogBackend, sets the event source, event id, category, and enables asynchronous delivery.
It is intentionally excluded from non-Windows builds.
The example target links ws2_32 together with logme, matching other Windows examples in this tree.
No console output was captured.
Repository folder: examples/WindowsEventLogBackend
#include <Logme/Logme.h>
#include <Logme/Backend/WindowsEventLogBackend.h>
#include <Logme/Channel.h>
#include <memory>
int main()
{
Logme::ID id{"eventlog"};
auto channel = Logme::Instance->CreateChannel(id);
auto config = std::make_shared<Logme::WindowsEventLogBackendConfig>();
config->Source = "LogmeExample";
config->EventId = 1000;
config->Category = 0;
config->Async = true;
auto backend = std::make_shared<Logme::WindowsEventLogBackend>(channel);
backend->ApplyConfig(config);
channel->AddBackend(backend);
LogmeI(channel, "Windows Event Log information record");
LogmeW(channel, "Windows Event Log warning record");
LogmeE(channel, "Windows Event Log error record");
backend->Flush();
return 0;
}Previous: TypicalUsage examples
logme — flexible runtime logging system
Home · Getting Started · Architecture · Output · Backends · Configuration
GitHub: https://github.com/efmsoft/logme
- Home
- Getting Started
- Why logme?
- Core Concepts
- Logging Macros
- Fatal Handling
- Crash Logging
- glog Compatibility
- C API
- Choosing Logging Macros
- Function tracing
- Trace Points
- Override Scopes
- Advanced Features
- Collapse Logging
- Feature Map
- Overview
- Console Backend
- Debugger Backend
- File Backend
- File Rotation & Retention
- Buffer Backend
- Ring Buffer Backend
- SharedFile Backend
- Callback Backend
- Windows Event Log Backend
- Custom Backends
- Runtime Control
- Configuration
- Configuration JSON
- Control Server
- Environment Control
- Control Policies
- Trace Points
- Message Filtering