-
Notifications
You must be signed in to change notification settings - Fork 3
Examples Override
Eduard Mishkurov edited this page Jun 3, 2026
·
7 revisions
This example shows how local overrides modify a log record.
- Creating a
Logme::Override - Removing the method name from output
- Using overrides with the default channel and a custom channel
- Stream-style and printf-style calls with the same override
- Overrides can be applied per call without changing global logger configuration.
2026-06-03 16:33:14:766 DefaultBehavior(): Default output
2026-06-03 16:33:14:766 Method removed (stream)
2026-06-03 16:33:14:766 Method removed (printf): 7
2026-06-03 16:33:14:766 W Warning with override
2026-06-03 16:33:14:766 E Error: Error with override: fail
Repository folder: examples/Override
#include <Logme/Logme.h>
static void DefaultBehavior()
{
LogmeI() << "Default output";
}
static void WithoutMethod()
{
Logme::Override ovr;
ovr.Remove.Method = true;
LogmeI(ovr) << "Method removed (stream)";
LogmeI(ovr, "Method removed (printf): %d", 7);
}
static void WithChannelAndOverride()
{
Logme::ID ch{"custom"};
auto channel = Logme::Instance->CreateChannel(ch);
channel->AddLink(::CH);
Logme::Override ovr;
ovr.Remove.Method = true;
LogmeW(ch, ovr) << "Warning with override";
LogmeE(ch, ovr, "Error with override: %s", "fail");
}
int main()
{
DefaultBehavior();
WithoutMethod();
WithChannelAndOverride();
return 0;
}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