ASW Lib
A.D.S. Games SDL Wrapper Library. A library targeted at Allegro4 users who want to switch to SDL3 and use modern c++.
Loading...
Searching...
No Matches
asw::log Namespace Reference

Enumerations

enum class  Level { DEBUG , INFO , WARN , ERROR }
 Log severity levels. More...
 

Functions

void log_message (Level level, const std::string &message)
 Log a message at the specified level. Messages below the current log level are ignored.
 
void set_level (Level level)
 Set the minimum log level (messages below this are ignored).
 
void set_output (std::ostream &stream)
 Set the output stream (default: std::cerr).
 
void debug (const std::string &message)
 Log a debug message.
 
template<typename... Args>
void debug (std::format_string< Args... > format, Args &&... args)
 Log a formatted debug message.
 
void info (const std::string &message)
 Log an info message.
 
template<typename... Args>
void info (std::format_string< Args... > format, Args &&... args)
 Log a formatted info message.
 
void warn (const std::string &message)
 Log a warning message.
 
template<typename... Args>
void warn (std::format_string< Args... > format, Args &&... args)
 Log a formatted warning message.
 
void error (const std::string &message)
 Log an error message.
 
template<typename... Args>
void error (std::format_string< Args... > format, Args &&... args)
 Log a formatted error message.
 
void progress (float progress, std::string message)
 Log a progress message with a percentage.
 
template<typename... Args>
void progress (float prog, std::format_string< Args... > format, Args &&... args)
 Log a progress message with a percentage.
 

Enumeration Type Documentation

◆ Level

enum class asw::log::Level
strong

Log severity levels.

Enumerator
DEBUG 
INFO 
WARN 
ERROR 

Definition at line 19 of file log.h.

Function Documentation

◆ debug() [1/2]

void asw::log::debug ( const std::string & message)

Log a debug message.

Parameters
messageThe message to log.

Definition at line 163 of file log.cpp.

◆ debug() [2/2]

template<typename... Args>
void asw::log::debug ( std::format_string< Args... > format,
Args &&... args )

Log a formatted debug message.

Parameters
formatThe format string.
argsThe arguments to format.

Definition at line 51 of file log.h.

◆ error() [1/2]

void asw::log::error ( const std::string & message)

Log an error message.

Parameters
messageThe message to log.

Definition at line 178 of file log.cpp.

◆ error() [2/2]

template<typename... Args>
void asw::log::error ( std::format_string< Args... > format,
Args &&... args )

Log a formatted error message.

Parameters
formatThe format string.
argsThe arguments to format.

Definition at line 100 of file log.h.

◆ info() [1/2]

void asw::log::info ( const std::string & message)

Log an info message.

Parameters
messageThe message to log.

Definition at line 168 of file log.cpp.

◆ info() [2/2]

template<typename... Args>
void asw::log::info ( std::format_string< Args... > format,
Args &&... args )

Log a formatted info message.

Parameters
formatThe format string.
argsThe arguments to format.

Definition at line 67 of file log.h.

◆ log_message()

void asw::log::log_message ( Level level,
const std::string & message )

Log a message at the specified level. Messages below the current log level are ignored.

Parameters
levelThe severity level of the message.
messageThe message to log.

Definition at line 112 of file log.cpp.

◆ progress() [1/2]

template<typename... Args>
void asw::log::progress ( float prog,
std::format_string< Args... > format,
Args &&... args )

Log a progress message with a percentage.

Parameters
progressThe progress value (0.0-1.0).
formatThe format string for the message.
argsThe arguments to format.

Definition at line 120 of file log.h.

◆ progress() [2/2]

void asw::log::progress ( float progress,
std::string message )

Log a progress message with a percentage.

Parameters
progressThe progress value (0.0-1.0).
formatThe format string for the message.
argsThe arguments to format.

Definition at line 183 of file log.cpp.

◆ set_level()

void asw::log::set_level ( Level level)

Set the minimum log level (messages below this are ignored).

Parameters
levelThe minimum level to log.

Definition at line 153 of file log.cpp.

◆ set_output()

void asw::log::set_output ( std::ostream & stream)

Set the output stream (default: std::cerr).

Parameters
streamThe output stream to write log messages to.

Definition at line 158 of file log.cpp.

◆ warn() [1/2]

void asw::log::warn ( const std::string & message)

Log a warning message.

Parameters
messageThe message to log.

Definition at line 173 of file log.cpp.

◆ warn() [2/2]

template<typename... Args>
void asw::log::warn ( std::format_string< Args... > format,
Args &&... args )

Log a formatted warning message.

Parameters
formatThe format string.
argsThe arguments to format.

Definition at line 84 of file log.h.