-
Notifications
You must be signed in to change notification settings - Fork 3
Examples Basic
Eduard Mishkurov edited this page Jun 10, 2026
·
7 revisions
This example shows the most basic logme usage.
- Stream-style logging with
LogmeI() << ... - Printf-style logging with
LogmeI("...", ...) - Logging to a custom channel
- Applying a local override to a single call
- Using
OBF(...)for an obfuscated string literal
- The default channel
::CHis available automatically. - Custom channels must be made visible by linking them to
::CHor by attaching backends directly.
2026-06-10 14:51:39:795 BasicStream(): Hello from stream API
2026-06-10 14:51:39:795 W BasicStream(): 123
2026-06-10 14:51:39:795 BasicPrintf(): Hello World
2026-06-10 14:51:39:795 E Error: BasicPrintf(): Error code: -1
2026-06-10 14:51:39:795 ChannelAndOverride(): Channel stream
2026-06-10 14:51:39:795 ChannelAndOverride(): Channel printf: 42
2026-06-10 14:51:39:795 Override stream
2026-06-10 14:51:39:795 Override printf: ok
2026-06-10 14:51:39:795 ObfuscatedPrint(): This line cannot be found when viewing the exe
Repository folder: examples/Basic
#include <Logme/Logme.h>
static void BasicStream()
{
LogmeI() << "Hello from stream API";
LogmeW() << 123;
}
static void BasicPrintf()
{
LogmeI("Hello %s", "World");
LogmeE("Error code: %d", -1);
}
static void ChannelAndOverride()
{
Logme::ID ch{"mychannel"};
auto channel = Logme::Instance->CreateChannel(ch);
channel->AddLink(::CH);
Logme::Override ovr;
ovr.Remove.Method = true;
LogmeI(ch) << "Channel stream";
LogmeI(ch, "Channel printf: %d", 42);
LogmeI(ch, ovr) << "Override stream";
LogmeI(ch, ovr, "Override printf: %s", "ok");
}
static void ObfuscatedPrint()
{
LogmeI(OBF("This line cannot be found when viewing the exe"));
}
int main()
{
BasicStream();
BasicPrintf();
ChannelAndOverride();
ObfuscatedPrint();
return 0;
}Next: CallbackBackend
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