logman 0.1.0
Modern C++23 header-only logging manager wrapping spdlog with channels, listeners, and structured events
Loading...
Searching...
No Matches
logman::InitConfig Struct Reference

Settings applied during LogManager::initialize(InitConfig). More...

#include <init_config.hpp>

Public Attributes

spdlog::level::level_enum default_level = spdlog::level::info
 Default level applied to the root logger and every channel created without an explicit prefix rule.
 
bool enable_console = true
 Install the colour console sink.
 
std::string pattern
 spdlog pattern string.
 
bool set_as_spdlog_default = true
 Install the "main" logger as spdlog::default_logger().
 
bool read_env = true
 When true, scan the process environment under env_prefixes for <PREFIX>LEVEL, <PREFIX>LEVEL_<NAMESPACE>, and <PREFIX>FORMAT.
 
std::vector< std::string > env_prefixes
 Prefixes to scan when read_env is true.
 
bool structured_json = false
 Emit one JSON object per line via JsonFormatter.
 

Detailed Description

Settings applied during LogManager::initialize(InitConfig).

All fields have sensible defaults; the no-arg initialize() overload uses the level argument and leaves the rest at the defaults below.

Member Data Documentation

◆ default_level

spdlog::level::level_enum logman::InitConfig::default_level = spdlog::level::info

Default level applied to the root logger and every channel created without an explicit prefix rule.

Env var <PREFIX>LEVEL overrides it when read_env is true.

◆ enable_console

bool logman::InitConfig::enable_console = true

Install the colour console sink.

Leave on for applications; libraries embedding logman may want to turn this off and add their own sinks via LogManager::add_sink.

◆ env_prefixes

std::vector<std::string> logman::InitConfig::env_prefixes

Prefixes to scan when read_env is true.

Defaults to the compile-time list baked in via the CMake cache variable LOGMAN_ENV_PREFIXES, which always contains LOGMAN_ and may contain additional consumer prefixes. Later entries override earlier ones.

◆ pattern

std::string logman::InitConfig::pattern

spdlog pattern string.

Empty selects the built-in pattern: Y-m-dTH:M:S.ez %^L%$ P --- [%6t] n : v. Ignored when structured_json is true (JSON output is unstructured by definition of "structured").

◆ set_as_spdlog_default

bool logman::InitConfig::set_as_spdlog_default = true

Install the "main" logger as spdlog::default_logger().

Preserved from Ghostframe behaviour — this is the global logger facility for the consuming program. Libraries embedding logman can opt out.

◆ structured_json

bool logman::InitConfig::structured_json = false

Emit one JSON object per line via JsonFormatter.

Requires <nlohmann/json.hpp> on the include path at compile time; otherwise the request is ignored and a stderr warning is emitted.


The documentation for this struct was generated from the following file: