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
| Member | Returns | Description |
|---|---|---|
configure(level?, logPath?) | void | Initialise logging. Defaults to warn level and "logs/glitter.log". Pass an empty string for logPath to disable file logging. |
configureSubsystem(name, level) | void | Override 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:
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:
| Value | Description |
|---|---|
trace | Extremely verbose — every tick, every byte |
debug | Developer diagnostics |
info | Normal operational messages |
warn | Something unexpected but recoverable |
error | A failure occurred; operation was skipped |
critical | Fatal — engine cannot continue |
off | Silence all output for this logger |
Configuration via 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++
// 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.