-
Notifications
You must be signed in to change notification settings - Fork 3
Examples OneTime
Eduard Mishkurov edited this page May 3, 2026
·
7 revisions
This example shows object-scoped one-time logging.
- Deriving from
OneTimeOverrideGenerator - Using
LOGME_ONCE4THIS - Printing a message only once per object instance
- This is useful for repetitive warnings that should appear once per object instead of once per call site.
2026-05-03 10:34:00:330 W Test::Method(): something went wrong!!!
Repository folder: examples/OneTime
#include <Logme/Logme.h>
struct Test : Logme::OneTimeOverrideGenerator
{
void Method()
{
// Even if this method is called many times, the message below will be printed only once for this object.
LogmeW(LOGME_ONCE4THIS, "something went wrong!!!");
}
};
int main()
{
Test test;
for (int i = 0; i < 1000; i++)
{
test.Method();
}
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