Repository navigation
Output Format
Hugo edited this page Oct 15, 2026
·
2 revisions
[timestamp] |PID| prefix [LEVEL] file:line (module) message
| Field | Present | Example |
|---|---|---|
| timestamp | with set_timestamps(true): UTC, millisecond precision |
[2026-09-30T08:15:02.417] |
| PID | always; a child of fork() shows its own |
|4242| |
| prefix | always, set with set_prefix() (default ==ct==, up to 63 characters) |
==ct== |
| LEVEL | always |
[DEBUG], [INFO], [WARN], [ERROR]
|
| file:line | with set_source_location(true), base name of the file |
main.cpp:42 |
| module | for tagged messages, when the name is not empty | (alloc) |
| message | the formatted message, as given | retrying 10.0.0.1 |
The library does not add a newline: end your format strings with \n.
coretrace::log(Level::Info, "plain\n");
coretrace::log(Level::Warn, Module("alloc"), "tagged\n");|4242| ==ct== [INFO] plain
|4242| ==ct== [WARN] (alloc) tagged
With timestamps, source locations and a custom prefix:
[2026-09-30T08:15:02.417] |4242| ==myapp== [WARN] main.cpp:60 (db) Connection pool exhausted, count=0
- An empty message (
log(Level::Info, "")) writes nothing. - An invalid format string writes
coretrace: log format errorfollowed by a newline instead of the line, with no prefix. The format string is only checked at run time, solog(Level::Info, "{} {}\n", 1)compiles. - When colors are on, the PID, prefix, level, location and module are wrapped in ANSI sequences (see Configuration).
Using the library
Working on the library