-
Notifications
You must be signed in to change notification settings - Fork 3
Examples ChannelSetup
Eduard Mishkurov edited this page May 3, 2026
·
7 revisions
This example shows how channel visibility is configured.
- Logging to a channel before it is configured
- Creating a channel explicitly
- Making it visible with
AddLink(::CH) - The simplest pattern for custom channels
- Creating a channel alone is not enough to see output.
- Linking to
::CHis the easiest way to reuse the default backend configuration.
2026-05-03 10:33:55:865 main(): Now visible via AddLink(::CH)
Repository folder: examples/ChannelSetup
#include <Logme/Logme.h>
#include <chrono>
#include <thread>
int main()
{
Logme::ID id{"invisible"};
// This is allowed, but you may not see any output if the channel is not created
// and does not have any backends or links.
LogmeI(id, "This may be invisible (channel has no backends/links yet)");
// Create the channel explicitly.
auto ch = Logme::Instance->CreateChannel(id);
// Option A: link to the default channel (::CH) which already has backends.
// This is the simplest way to make a custom channel visible.
ch->AddLink(::CH);
LogmeI(id, "Now visible via AddLink(::CH)");
// Option B: add a backend directly (example: console backend).
// If you prefer this approach, keep AddLink() disabled to avoid duplicate output.
//
// ch->AddBackend(std::make_shared<ConsoleBackend>(ch));
// Small delay so the user can see output in quick runs.
std::this_thread::sleep_for(std::chrono::milliseconds(10));
return 0;
}Previous: Channels | Next: DumpBuffer
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