|
Vulkan Schnee 0.0.1 (22840dc8)
High-performance rendering engine
|
Logging uses Unreal Engine-style categories through the VS_LOG() family of macros. Every log message is tagged with a category name and a verbosity level, which lets you filter output per subsystem at runtime and strip debug noise at compile time.
Include Engine/Logging/LogCategories.h to get both the engine's log categories and the logging macros.
Logs one formatted message under the given category and verbosity.
Parameters:
Example:
Logs a plain string without format arguments. Slightly cheaper than VS_LOG() when the message has no placeholders.
Example:
Logs only when Condition evaluates to true. Use it to keep noisy checks on one line.
Parameters:
Example:
Logs only the first time this line is executed in a run. Good for one-time warnings fired from hot loops.
Example:
Shorter forms that bake in the verbosity level.
| Macro | Equivalent to |
|---|---|
| VS_LOG_FATAL(Category, Format, ...) | VS_LOG(Category, Fatal, ...) |
| VS_LOG_ERROR(Category, Format, ...) | VS_LOG(Category, Error, ...) |
| VS_LOG_WARNING(Category, Format, ...) | VS_LOG(Category, Warning, ...) |
| VS_LOG_INFO(Category, Format, ...) | VS_LOG(Category, Info, ...) |
| VS_LOG_DEBUG(Category, Format, ...) | VS_LOG(Category, Debug, ...) |
| VS_LOG_VERBOSE(Category, Format, ...) | VS_LOG(Category, Verbose, ...) |
Example:
Levels are ordered from most to least severe. All aliases Verbose and Off aliases Fatal.
| Level | Meaning |
|---|---|
| Fatal | Unrecoverable error, may crash |
| Error | Recoverable error |
| Warning | Potential issue |
| Info | Important state changes |
| Debug | Development debugging |
| Verbose | Detailed tracing |
A message is emitted only if its verbosity is at most the category's configured level. Info logs everything down to Info; Verbose logs everything.
Categories are defined engine-wide in Engine/Logging/LogCategories.h. They follow Unreal naming with a Log prefix and are grouped by subsystem.
| Category | Purpose |
|---|---|
| LogEngine | Engine lifecycle, initialization, shutdown |
| LogRenderer | Main render loop, frame timing |
| LogVulkan | Vulkan API calls, validation, resource management |
| LogLOD | Cluster LOD selection, hierarchy generation |
| LogMeshlet | Meshlet generation, culling, unpacking |
| LogRenderData | GPU buffer management, data uploads |
| LogTransfer | GPU buffer transfers, staging buffer operations |
| LogCompute | Compute shader dispatch, pipeline execution |
| LogAssets | Asset loading, caching, lifecycle |
| LogTexture | Texture loading, GPU upload, compression |
| LogMaterial | Material compilation, shader binding |
| LogMesh | Mesh/GLTF loading, geometry processing |
| LogXR | OpenXR session, runtime, layers |
| LogXRInput | VR input, controller tracking |
| LogPhysics | Physics simulation, collision detection |
| LogECS | Entity Component System operations |
| LogScene | Scene management, actor lifecycle |
| LogTemp | Temporary debugging (like UE's LogTemp), always verbose by default |
| LogFile | File I/O operations |
| LogConfig | Configuration loading, settings |
Gameplay code can define its own categories with the macros in EngineCore::LogCategory:
DEFINE_LOG_CATEGORY_STATIC(LogMySystem, Info, Verbose) creates a category usable only within a single file.
Each category has a runtime verbosity that can be changed while the game runs. The thread-safe EngineCore::LogCategoryManager singleton holds all registered categories.
Verbosity settings can be loaded from and saved to a JSON config file:
Default applies to every category not explicitly listed. Unrecognized strings fall back to Info.
Messages are also filtered at compile time so verbose logging can be stripped from Release builds entirely. The compile-time ceiling is VS_LOG_COMPILE_TIME_VERBOSITY:
Define VS_LOG_COMPILE_TIME_VERBOSITY yourself to override, for example to build a profiling build that drops all logging:
The macro emits no code for verbosity levels above the ceiling, so VS_LOG_DEBUG() and VS_LOG_VERBOSE() become free in optimized builds.
Format strings follow std::format. Use {} placeholders and standard format specifiers.
Logging routes through plog. Every message is prefixed with its category name, for example [LogLOD] Generated 42 clusters in 3.1 ms.
The engine writes to both a timestamped log file (GameLog_YYYY-MM-DD_HH-MM-SS.log) and a color console. EngineCore::initializePlog() sets this up and must be called at the very start of main() before any engine code runs, so even Vulkan validation layer messages are captured.