-
Notifications
You must be signed in to change notification settings - Fork 2
Output Format
logme produces log messages using a well-defined field order.
Individual fields can be enabled, disabled, or formatted using OutputFlags.
The logical order of fields in a log message is:
<time><signature><[proc:thread]><{channel_name}><#subsystem><location><error prefix><code_method><message><eol>
Not all fields are always present. Their presence depends on OutputFlags.
Timestamp of the log message.
Controlled by OutputFlags.Timestamp using TimeFormat:
enum TimeFormat
{
TIME_FORMAT_NONE,
TIME_FORMAT_LOCAL,
TIME_FORMAT_TZ,
TIME_FORMAT_UTC,
};Single-character severity signature:
-
D— Debug - (empty) — Info
-
W— Warning -
E— Error -
C— Critical Error
Info messages intentionally have no signature to reduce visual noise.
Controlled by OutputFlags.Signature.
Process and thread identifier.
- Printed only if
ThreadIDorProcessIDis enabled - Format:
[proc:thread] - Either part may be omitted
Threads may be assigned names.
If a thread name is set using SetThreadName, the first log entry shows a transition:
:380 -> StartIO
When a name is removed:
:StartIO -> 380
This behavior is controlled by OutputFlags.ThreadTransition.
Name of the channel specified by the user when emitting the log message.
This may differ from the channel that actually outputs the message, due to linked channels and routing.
Controlled by OutputFlags.Channel.
Name of the subsystem associated with the log message.
Subsystems allow logical grouping of messages independently of channels. They can be enabled or disabled selectively.
Controlled by OutputFlags.Subsystem.
Source code location where the message was emitted.
Controlled by OutputFlags.Location using Detality:
enum Detality
{
DETALITY_NONE,
DETALITY_SHORT,
DETALITY_FULL
};-
NONE— not printed -
SHORT— module name and line -
FULL— full path and line
Printed as:
file:line
Automatically prepended for error-level messages:
Error:Critical:
Controlled by OutputFlags.ErrorPrefix.
Name of the method that emitted the log message.
Printed as:
MethodName():
Controlled by OutputFlags.Method.
When OutputFlags.Method is enabled, the method name inserted into the log line
may become very long (for example, due to namespaces and template parameters).
If the same long prefix is repeated on every line, it can significantly bloat
log size and reduce readability.
To address this, a channel can be configured with a shortener table. During formatting, the method name text is scanned and configured replacements are applied (long text → short alias). This operation is designed to be very fast and does not perform memory allocations in the replacement hot path.
Example:
static const Logme::ShortenerPair shorteners[] =
{
{"nghttp2::DirectReader", "[dreader]"},
{"Syncme::Socket", "[skt]"},
{nullptr, nullptr}
};
pch->SetShortenerPair(shorteners);Result:
2026-02-12 21:12:08:950 [:Autodetect] [skt]::SetOptions(): server: TCP_NODELAY was set to true
2026-02-12 21:13:17:278 [:RSVal] [dreader]::Read(): 1: sent 1554 (remains 0)
The actual user-provided log message.
End-of-line character.
Controlled by OutputFlags.Eol.
logme — flexible runtime logging system
Home · Getting Started · Architecture · Output · Backends · Configuration
GitHub: https://github.com/efmsoft/logme