Basic Example¶
A minimal example using the full Backend / Frontend API with a console sink.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
Key points:
A
Sinkand aLoggerare each identified by a unique name so they can be retrieved later.Each
Loggerowns aPatternFormatter(controls layout) and one or moreSinkobjects (control output destinations).Backend::start()must be called before log messages can be processed. The backend thread stops automatically when the application exits normally.A macro-free logging interface is also available (see Macro-Free Mode), but the
LOG_*macros are recommended for lowest latency because static metadata is resolved at compile time and arguments are not evaluated when the level is disabled.
See Quick Start for the simple-setup path, or Guides for sinks, formatters, and advanced configuration.