|
SleakEngine 1.0.0
C++23 multi-backend game engine
|
#include <Logger.hpp>
Static Public Member Functions | |
| static std::shared_ptr< spdlog::logger > & | GetCoreLogger () |
| Logger used by engine code (SLEAK_ENGINE builds). | |
| static std::shared_ptr< spdlog::logger > & | GetLogger () |
| Logger used by game code. | |
| static void | Init (const std::string &ProjectName) |
| Creates the console + file sinks and registers both loggers. Call once at startup. | |
Sets up the engine and game spdlog sinks. Access via the SLEAK_LOG / SLEAK_INFO / SLEAK_WARN / SLEAK_ERROR macros rather than directly.
Call Init() once from main() before anything else logs, passing your project name. It creates a colored console sink and a file sink, and registers two loggers behind them: one for engine internals and one for game code. The macros pick the right logger automatically based on which target is compiling, so game code and engine code both just use SLEAK_LOG and friends.
Messages use fmt-style {} placeholders, not printf specifiers. The five levels, from quietest to loudest, are SLEAK_LOG (trace), SLEAK_INFO, SLEAK_WARN, SLEAK_ERROR, and SLEAK_FATAL. SLEAK_RETURN_ERR logs at error level and returns false, which suits initialization paths.
Definition at line 68 of file Logger.hpp.
|
static |
Logger used by engine code (SLEAK_ENGINE builds).
Definition at line 103 of file Logger.cpp.
|
static |
Logger used by game code.
Definition at line 108 of file Logger.cpp.
|
static |
Creates the console + file sinks and registers both loggers. Call once at startup.
Definition at line 34 of file Logger.cpp.