Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
esengine::Log Class Reference

Static logging interface. More...

#include <Log.hpp>

Static Public Member Functions

static void init ()
 Initializes the logging system.
static void shutdown ()
 Shuts down the logging system.
static void setLevel (LogLevel level)
 Sets the minimum log level.
static LogLevel getLevel ()
 Gets the current minimum log level.
static u32 addSink (LogSink sink)
 Registers a log sink to receive log entries.
static void removeSink (u32 sinkId)
 Unregisters a log sink.
template<typename... Args>
static void trace (const char *fmt, Args &&... args)
 Logs a trace message.
template<typename... Args>
static void debug (const char *fmt, Args &&... args)
 Logs a debug message.
template<typename... Args>
static void info (const char *fmt, Args &&... args)
 Logs an info message.
template<typename... Args>
static void warn (const char *fmt, Args &&... args)
 Logs a warning message.
template<typename... Args>
static void error (const char *fmt, Args &&... args)
 Logs an error message.
template<typename... Args>
static void fatal (const char *fmt, Args &&... args)
 Logs a fatal error message.

Detailed Description

Static logging interface.

Provides formatted logging with severity levels. Uses a simple {} placeholder syntax for formatting arguments.

Log::info("Player {} scored {} points", playerName, score);
Log::error("Failed to load: {}", filename);
static void info(const char *fmt, Args &&... args)
Logs an info message.
Definition Log.hpp:152
static void error(const char *fmt, Args &&... args)
Logs an error message.
Definition Log.hpp:174
Note
For convenience, use the ES_LOG_* macros which provide the same functionality with automatic debug stripping.

Definition at line 82 of file Log.hpp.

Member Function Documentation

◆ addSink()

u32 esengine::Log::addSink ( LogSink sink)
static

Registers a log sink to receive log entries.

Parameters
sinkCallback function to receive log entries
Returns
Sink ID for unregistration

Definition at line 62 of file Log.cpp.

References esengine::sink().

◆ debug()

template<typename... Args>
void esengine::Log::debug ( const char * fmt,
Args &&... args )
inlinestatic

Logs a debug message.

Template Parameters
ArgsFormat argument types
Parameters
fmtFormat string with {} placeholders
argsFormat arguments

Definition at line 141 of file Log.hpp.

References esengine::Debug.

◆ error()

template<typename... Args>
void esengine::Log::error ( const char * fmt,
Args &&... args )
inlinestatic

Logs an error message.

Template Parameters
ArgsFormat argument types
Parameters
fmtFormat string with {} placeholders
argsFormat arguments

Definition at line 174 of file Log.hpp.

References esengine::Error.

◆ fatal()

template<typename... Args>
void esengine::Log::fatal ( const char * fmt,
Args &&... args )
inlinestatic

Logs a fatal error message.

Template Parameters
ArgsFormat argument types
Parameters
fmtFormat string with {} placeholders
argsFormat arguments

Definition at line 185 of file Log.hpp.

References esengine::Fatal.

◆ getLevel()

LogLevel esengine::Log::getLevel ( )
static

Gets the current minimum log level.

Returns
The current log level threshold

Definition at line 46 of file Log.cpp.

◆ info()

template<typename... Args>
void esengine::Log::info ( const char * fmt,
Args &&... args )
inlinestatic

Logs an info message.

Template Parameters
ArgsFormat argument types
Parameters
fmtFormat string with {} placeholders
argsFormat arguments

Definition at line 152 of file Log.hpp.

References esengine::Info.

Referenced by init(), and shutdown().

◆ init()

void esengine::Log::init ( )
static

Initializes the logging system.

Definition at line 29 of file Log.cpp.

References esengine::Info, info(), and esengine::Trace.

◆ removeSink()

void esengine::Log::removeSink ( u32 sinkId)
static

Unregisters a log sink.

Parameters
sinkIdID returned from addSink

Definition at line 69 of file Log.cpp.

◆ setLevel()

void esengine::Log::setLevel ( LogLevel level)
static

Sets the minimum log level.

Parameters
levelMessages below this level are filtered

Definition at line 42 of file Log.cpp.

◆ shutdown()

void esengine::Log::shutdown ( )
static

Shuts down the logging system.

Definition at line 38 of file Log.cpp.

References info().

◆ trace()

template<typename... Args>
void esengine::Log::trace ( const char * fmt,
Args &&... args )
inlinestatic

Logs a trace message.

Template Parameters
ArgsFormat argument types
Parameters
fmtFormat string with {} placeholders
argsFormat arguments

Definition at line 130 of file Log.hpp.

References esengine::Trace.

◆ warn()

template<typename... Args>
void esengine::Log::warn ( const char * fmt,
Args &&... args )
inlinestatic

Logs a warning message.

Template Parameters
ArgsFormat argument types
Parameters
fmtFormat string with {} placeholders
argsFormat arguments

Definition at line 163 of file Log.hpp.

References esengine::Warn.


The documentation for this class was generated from the following files:
  • /home/runner/work/estella/estella/src/esengine/core/Log.hpp
  • /home/runner/work/estella/estella/src/esengine/core/Log.cpp