Skip to content

LoggerConfig

#include <mrx/logging/Logging.hpp>
struct mrx::logging::LoggerConfig

Runtime configuration for the SDK logging bootstrap.

The configuration deliberately stays small so the common case is still a single initLogger() call. The defaults target production deployments by preferring the best backend compiled into the library, writing spdlog files under /var/log, enabling journald when that backend supports it, and using the Qt log category name as the logger scope unless a custom mapping overrides it.

ReturnNameDescription
BackendTypebackendSelects which backend should be activated for this process.
QStringapplicationNameLogical application name used when deriving default logger names and filenames.
QStringlogDirectoryDirectory that should receive the asynchronous file sink when the spdlog backend is active.
QStringlogFileNameOptional explicit log filename for the spdlog backend.
boolenableJournaldEnables the journald sink when the spdlog backend was built with Linux journald support.
boolenableStacktracesEnables best-effort stacktrace capture for fatal Qt log messages.
QHash<QString, QString>categoryMappingsOptional overrides from Qt log category names to backend sink/logger names.

BackendType backend = BackendType::Default

Type: BackendType

Selects which backend should be activated for this process.

Default chooses Spdlog.


QString applicationName = {}

Logical application name used when deriving default logger names and filenames.

Both concrete logging paths use this name when they need an application-scoped fallback for output formatting or spdlog-managed filenames.


QString logDirectory = QStringLiteral("/var/log")

Directory that should receive the asynchronous file sink when the spdlog backend is active.

Only the Spdlog backend uses this field because the direct QtLogging path writes straight to the process output streams instead of managing file sinks.


QString logFileName = {}

Optional explicit log filename for the spdlog backend.

When empty, <applicationName>.log is derived. Only the Spdlog backend uses this field because the direct QtLogging path does not manage file sinks.


bool enableJournald = true

Enables the journald sink when the spdlog backend was built with Linux journald support.

Only the Spdlog backend uses this field because the direct QtLogging path does not route logs through journald.


bool enableStacktraces = true

Enables best-effort stacktrace capture for fatal Qt log messages.

Both concrete logging paths use this flag when they render fatal records.


QHash<QString, QString> categoryMappings = {}

Optional overrides from Qt log category names to backend sink/logger names.

Both built-in backends use the same mapping semantics so applications can keep one shared configuration shape regardless of which backend becomes active.