Struct thl::Logger::LoggerConfig#

struct LoggerConfig#

Collaboration diagram for thl::Logger::LoggerConfig:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "3" [label="std::basic_string< Char >" tooltip="std::basic_string< Char >"] "2" [label="std::string" tooltip="std::string"] "1" [label="thl::Logger::LoggerConfig" tooltip="thl::Logger::LoggerConfig" fillcolor="#BFBFBF"] "2" -> "3" [dir=forward tooltip="public-inheritance"] "1" -> "2" [dir=forward tooltip="usage"] }

Global sink configuration.

Controls which sinks are active. Apply with set_config(); read back with get_config(). Defaults: platform on, file off, callback on.

Platform sink identity

What the platform sink files records under, so a consumer that embeds the logger can be found by its own name: adb logcat -s <tag> on Android, log stream –predicate ‘subsystem == “<subsystem>”` or a Console.app filter on Apple platforms.

Set them before the first record: the sink reads the identity when it files each record, so records logged earlier go out under the defaults. A later set_config() applies to every record dispatched after it returns (a dispatch already in flight may still use the previous identity); on Apple platforms each change creates a new os_log_t, which the system never releases, so the identity is configuration, not something to switch per record. An empty string selects the default. Ignored by the plain stdout/stderr platform sink (Linux without journald, Windows, Emscripten).

std::string m_platform_tag = "thl"#

Android logcat tag; journald SYSLOG_IDENTIFIER.

std::string m_platform_subsystem = "thl"#

os_log subsystem (macOS, iOS).

std::string m_platform_category = "logger"#

os_log category (macOS, iOS).

Public Members

bool m_platform_enabled = true#

Platform sink (os_log / android_log / stdout+stderr).

bool m_console_enabled = false#

Explicit stdout/stderr sink (errors+warnings to stderr, rest to stdout).

bool m_file_enabled = true#

Logfmt file sink.

bool m_callback_enabled = true#

Gate for the registered callback.

std::string m_file_path#

Output path for the file sink (empty = no writes).

std::size_t m_early_buffer_capacity = 64#

Maximum number of records to buffer while no callback is registered.

When a callback is set via set_callback(), buffered records are replayed synchronously. Set to 0 to disable buffering.

bool m_rt_enabled = true#

Start the process-wide real-time drain thread (see thl::Logger::rt) when this config is applied, and stop it when applied with false.

The thread is never started implicitly: without set_config() or rt::start(), rt::logf() reports NoConsumer unless the host pumps rt::drain() itself (rt::enable_manual_drain()).

std::uint32_t m_rt_drain_interval_ms = 10#

Interval at which the drain thread flushes real-time records into the sinks.

Bounds both delivery latency and the burst the queue must hold between two drains (queue capacity / interval = sustainable rate).