engine::util::Logger class

A simple logger utility for the engine and client.

Supports console output and optional file output. Formats messages with file, line, and severity information.

Public static functions

static auto Get() -> Logger&
Gets the singleton instance of the Logger.

Public functions

void Init(const std::string& filename = "")
Initializes the logger.
void Log(LogLevel level, const char* file, int line, const char* format, ...)
Logs a message with the specified severity.
auto IsInitialized() const -> bool
Returns whether the logger has been initialized.

Function documentation

static Logger& engine::util::Logger::Get()

Gets the singleton instance of the Logger.

Returns Reference to the Logger instance.

void engine::util::Logger::Init(const std::string& filename = "")

Initializes the logger.

Parameters
filename Optional filename for log output.

If a filename is provided, logs will be written to "logs/<filename>". Otherwise, it logs only to the console.

void engine::util::Logger::Log(LogLevel level, const char* file, int line, const char* format, ...)

Logs a message with the specified severity.

Parameters
level Severity level.
file Source file where the log was called.
line Source line where the log was called.
format Printf-style format string.