Skip to content
Eduard Mishkurov edited this page May 3, 2026 · 28 revisions

logme

logme is a C/C++ logging library designed for real-world systems where logging is not just debugging output, but a tool for operating and diagnosing a running application.

The library focuses on three things:

  • low overhead when logging is disabled or filtered out
  • efficient logging path when messages are actually written
  • full control over logging behavior at runtime

This allows using detailed logging in production without paying the cost permanently.


What makes logme different

Most logging libraries treat logging as something configured once at startup.

logme treats logging as a runtime system.

You can:

  • enable or disable channels
  • change log levels
  • add or remove backends
  • switch output formats

…all without restarting the application.


How logging is organized

Logging in logme is built around a few core concepts.

A channel is the main logging entity.
It represents a logical part of the system (for example HTTP, TLS, or database).

A subsystem (SID) is an additional classification tag used for filtering inside a channel.

Messages are routed to backends, which define where logs are written (console, file, debug output, etc.).

Each log message is processed through an internal context, which handles formatting and structured output.


Structured logging

In addition to the default text format, logme supports structured logging in two ways.

First, it can produce JSON or XML directly at runtime.
Each message becomes a structured event suitable for real-time processing.

Second, existing logs can be converted using the logmefmt tool, allowing generation of finalized JSON or XML documents.


File logging in production

File logging is designed to work reliably in long-running systems.

logme supports:

  • size-based rotation
  • daily rotation
  • limiting the number of log files
  • limiting total directory size

Old files are removed automatically, while the active file is never affected.


Asynchronous logging

File logging is performed asynchronously to avoid blocking the application.

Console output is coordinated to preserve message ordering even in multithreaded scenarios.


Minimal overhead

When logging is disabled, logme avoids unnecessary work.

The library uses a precheck mechanism that ensures formatting and argument evaluation are skipped whenever possible.

This optimization applies not only to disabled logging, but also to active logging paths, especially when using asynchronous backends.


Practical details

logme works on major platforms (Windows, Linux, macOS) and supports modern C++ standards.

It provides native formatting support, allowing both printf-style usage and C++-style streaming.

Additional capabilities include:

  • controlling message frequency (log once / log every N times)
  • boot/early logging before configuration is loaded

These features are built into the core and do not require external components.


Quick example

LogmeI("Server started on port %d", port);

No initialization is required.


Next steps

  • Core Concepts
  • Structured Logging
  • File Rotation & Retention
  • Runtime Control
  • Advanced Features

Clone this wiki locally