Skip to main content

Logging API

Header: src/logging/log_manager.h
Namespace: glitter::logging


glitter::logging::log_manager

Static log manager backed by spdlog. Configured automatically by the engine during initialisation via apply_logging_configuration(). Direct use is only needed for custom subsystem loggers or non-engine executables.

log_manager is not constructible — all members are static.

Static methods

MemberReturnsDescription
configure(level?, logPath?)voidInitialise logging. Defaults to warn level and "logs/glitter.log". Pass an empty string for logPath to disable file logging.
configureSubsystem(name, level)voidOverride the log level for a named subsystem logger
get(name)shared_ptr<spdlog::logger>Get an existing logger by name, or create a new one if it does not exist yet

Convenience helper

Defined in src/core/engine.h — available without a full engine instance:

src/core/engine.h
std::shared_ptr<spdlog::logger> glitter::getLogger(const std::string& name)

Shortcut for glitter::logging::log_manager::get(name).


Log levels

spdlog::level::level_enum values used throughout the engine configuration:

ValueDescription
traceExtremely verbose — every tick, every byte
debugDeveloper diagnostics
infoNormal operational messages
warnSomething unexpected but recoverable
errorA failure occurred; operation was skipped
criticalFatal — engine cannot continue
offSilence all output for this logger

Configuration via engine.config.json

engine.config.json
{
"logging_level": "warn",
"subsystem_levels": {
"render": "info",
"scene": "debug"
}
}

The global logging_level applies to all loggers not listed in subsystem_levels. Applied automatically by apply_logging_configuration() during engine init.


Usage in C++

Logging example
// Obtain a named logger (creates it if it doesn't exist)
auto log = glitter::getLogger("my_subsystem");

log->info("Scene loaded: {}", sceneName);
log->warn("Texture missing: {}", texPath);
log->error("Renderer init failed: {}", reason);

The log file is written to logs/glitter.log alongside the executable (e.g. build/src/Debug/logs/glitter.log). This is the first place to look when diagnosing runtime crashes.