Helios Engine
A modular ECS based data-oriented C++23 game engine framework
Loading...
Searching...
No Matches
helios::log Namespace Reference

Namespaces

namespace  details

Classes

struct  Config
 Configuration for logger behavior and output. More...
struct  DefaultLogger
 Default logger type. More...
class  Logger
 Centralized logging system with configurable output and formatting. More...

Concepts

concept  LoggerTrait
 Trait to identify valid logger types.
concept  LoggerWithConfigTrait
 Trait to identify loggers with custom configuration.

Typedefs

using LoggerTypeId = utils::TypeId
 Type alias for logger type IDs.
using LoggerTypeIndex = utils::TypeIndex
 Type alias for logger type indices.

Enumerations

enum class  Level : uint8_t {
  kTrace = 0 , kDebug = 1 , kInfo = 2 , kWarn = 3 ,
  kError = 4 , kCritical = 5
}
 Log severity levels. More...

Functions

template<LoggerTrait T>
constexpr std::string_view LoggerNameOf (T={}) noexcept
 Gets the name of a logger type.
template<LoggerTrait T>
constexpr Config LoggerConfigOf (T={}) noexcept
 Gets the configuration for a logger type.
void Trace (std::string_view) noexcept
template<typename... Args>
void Trace (Args &&...) noexcept
template<LoggerTrait T>
void Trace (T, std::string_view) noexcept
template<LoggerTrait T, typename... Args>
void Trace (T, Args &&...) noexcept
void Debug (std::string_view) noexcept
template<typename... Args>
void Debug (Args &&...) noexcept
template<LoggerTrait T>
void Debug (T, std::string_view) noexcept
template<LoggerTrait T, typename... Args>
void Debug (T, Args &&...) noexcept
void Info (std::string_view message) noexcept
 Logs an info message with the default logger.
template<typename... Args>
requires (sizeof...(Args) > 0)
void Info (std::format_string< Args... > fmt, Args &&... args) noexcept
 Logs a formatted info message with the default logger.
template<LoggerTrait T>
void Info (T logger, std::string_view message) noexcept
 Logs an info message with the specified logger.
template<LoggerTrait T, typename... Args>
requires (sizeof...(Args) > 0)
void Info (T logger, std::format_string< Args... > fmt, Args &&... args) noexcept
 Logs a formatted info message with the specified logger.
void Warn (std::string_view message) noexcept
 Logs a warning message with the default logger.
template<typename... Args>
requires (sizeof...(Args) > 0)
void Warn (std::format_string< Args... > fmt, Args &&... args) noexcept
 Logs a formatted warning message with the default logger.
template<LoggerTrait T>
void Warn (T logger, std::string_view message) noexcept
 Logs a warning message with the specified logger.
template<LoggerTrait T, typename... Args>
requires (sizeof...(Args) > 0)
void Warn (T logger, std::format_string< Args... > fmt, Args &&... args) noexcept
 Logs a formatted warning message with the specified logger.
void Error (std::string_view message) noexcept
 Logs an error message with the default logger.
template<typename... Args>
requires (sizeof...(Args) > 0)
void Error (std::format_string< Args... > fmt, Args &&... args) noexcept
 Logs a formatted error message with the default logger.
template<LoggerTrait T>
void Error (T logger, std::string_view message) noexcept
 Logs an error message with the specified logger.
template<LoggerTrait T, typename... Args>
requires (sizeof...(Args) > 0)
void Error (T logger, std::format_string< Args... > fmt, Args &&... args) noexcept
 Logs a formatted error message with the specified logger.
void Critical (std::string_view message) noexcept
 Logs a critical message with the default logger.
template<typename... Args>
requires (sizeof...(Args) > 0)
void Critical (std::format_string< Args... > fmt, Args &&... args) noexcept
 Logs a formatted critical message with the default logger.
template<LoggerTrait T>
void Critical (T logger, std::string_view message) noexcept
 Logs a critical message with the specified logger.
template<LoggerTrait T, typename... Args>
requires (sizeof...(Args) > 0)
void Critical (T logger, std::format_string< Args... > fmt, Args &&... args) noexcept
 Logs a formatted critical message with the specified logger.

Variables

constexpr DefaultLogger kDefaultLogger {}
 Constexpr instance of the default logger for easier user interface.

Typedef Documentation

◆ LoggerTypeId

Type alias for logger type IDs.

Definition at line 95 of file config.hpp.

◆ LoggerTypeIndex

Type alias for logger type indices.

Definition at line 98 of file config.hpp.

Enumeration Type Documentation

◆ Level

enum class helios::log::Level : uint8_t
strong

Log severity levels.

Enumerator
kTrace 
kDebug 
kInfo 
kWarn 
kError 
kCritical 

Definition at line 14 of file config.hpp.

Function Documentation

◆ Critical() [1/4]

template<typename... Args>
requires (sizeof...(Args) > 0)
void helios::log::Critical ( std::format_string< Args... > fmt,
Args &&... args )
inlinenoexcept

Logs a formatted critical message with the default logger.

Template Parameters
ArgsTypes of the format arguments
Parameters
fmtFormat string
argsArguments for the format string

Definition at line 636 of file logger.hpp.

◆ Critical() [2/4]

void helios::log::Critical ( std::string_view message)
inlinenoexcept

Logs a critical message with the default logger.

Parameters
messageThe message to log

Definition at line 624 of file logger.hpp.

◆ Critical() [3/4]

template<LoggerTrait T, typename... Args>
requires (sizeof...(Args) > 0)
void helios::log::Critical ( T logger,
std::format_string< Args... > fmt,
Args &&... args )
inlinenoexcept

Logs a formatted critical message with the specified logger.

Template Parameters
TLogger type
ArgsTypes of the format arguments
Parameters
loggerLogger type instance
fmtFormat string
argsArguments for the format string

Definition at line 661 of file logger.hpp.

◆ Critical() [4/4]

template<LoggerTrait T>
void helios::log::Critical ( T logger,
std::string_view message )
inlinenoexcept

Logs a critical message with the specified logger.

Template Parameters
TLogger type
Parameters
loggerLogger type instance
messageThe message to log

Definition at line 647 of file logger.hpp.

◆ Debug() [1/4]

template<typename... Args>
void helios::log::Debug ( Args && ...)
inlinenoexcept

Definition at line 470 of file logger.hpp.

◆ Debug() [2/4]

void helios::log::Debug ( std::string_view )
inlinenoexcept

Definition at line 467 of file logger.hpp.

◆ Debug() [3/4]

template<LoggerTrait T, typename... Args>
void helios::log::Debug ( T ,
Args && ... )
inlinenoexcept

Definition at line 476 of file logger.hpp.

◆ Debug() [4/4]

template<LoggerTrait T>
void helios::log::Debug ( T ,
std::string_view  )
inlinenoexcept

Definition at line 473 of file logger.hpp.

◆ Error() [1/4]

template<typename... Args>
requires (sizeof...(Args) > 0)
void helios::log::Error ( std::format_string< Args... > fmt,
Args &&... args )
inlinenoexcept

Logs a formatted error message with the default logger.

Template Parameters
ArgsTypes of the format arguments
Parameters
fmtFormat string
argsArguments for the format string

Definition at line 589 of file logger.hpp.

◆ Error() [2/4]

void helios::log::Error ( std::string_view message)
inlinenoexcept

Logs an error message with the default logger.

Parameters
messageThe message to log

Definition at line 577 of file logger.hpp.

◆ Error() [3/4]

template<LoggerTrait T, typename... Args>
requires (sizeof...(Args) > 0)
void helios::log::Error ( T logger,
std::format_string< Args... > fmt,
Args &&... args )
inlinenoexcept

Logs a formatted error message with the specified logger.

Template Parameters
TLogger type
ArgsTypes of the format arguments
Parameters
loggerLogger type instance
fmtFormat string
argsArguments for the format string

Definition at line 614 of file logger.hpp.

◆ Error() [4/4]

template<LoggerTrait T>
void helios::log::Error ( T logger,
std::string_view message )
inlinenoexcept

Logs an error message with the specified logger.

Template Parameters
TLogger type
Parameters
loggerLogger type instance
messageThe message to log

Definition at line 600 of file logger.hpp.

◆ Info() [1/4]

template<typename... Args>
requires (sizeof...(Args) > 0)
void helios::log::Info ( std::format_string< Args... > fmt,
Args &&... args )
inlinenoexcept

Logs a formatted info message with the default logger.

Template Parameters
ArgsTypes of the format arguments
Parameters
fmtFormat string
argsArguments for the format string

Definition at line 495 of file logger.hpp.

◆ Info() [2/4]

void helios::log::Info ( std::string_view message)
inlinenoexcept

Logs an info message with the default logger.

Parameters
messageThe message to log

Definition at line 483 of file logger.hpp.

◆ Info() [3/4]

template<LoggerTrait T, typename... Args>
requires (sizeof...(Args) > 0)
void helios::log::Info ( T logger,
std::format_string< Args... > fmt,
Args &&... args )
inlinenoexcept

Logs a formatted info message with the specified logger.

Template Parameters
TLogger type
ArgsTypes of the format arguments
Parameters
loggerLogger type instance
fmtFormat string
argsArguments for the format string

Definition at line 520 of file logger.hpp.

◆ Info() [4/4]

template<LoggerTrait T>
void helios::log::Info ( T logger,
std::string_view message )
inlinenoexcept

Logs an info message with the specified logger.

Template Parameters
TLogger type
Parameters
loggerLogger type instance
messageThe message to log

Definition at line 506 of file logger.hpp.

◆ LoggerConfigOf()

template<LoggerTrait T>
Config helios::log::LoggerConfigOf ( T = {})
nodiscardconstexprnoexcept

Gets the configuration for a logger type.

Returns the config provided by kConfig variable if available, otherwise returns the default configuration.

Template Parameters
TLogger type
Parameters
loggerlogger instance
Returns
Config for the logger
struct MyLogger {
static constexpr std::string_view kName = "MyLogger";
static constexpr auto kConfig = Config::ConsoleOnly();
};
constexpr auto config = LoggerConfigOf<MyLogger>();
constexpr Config LoggerConfigOf(T={}) noexcept
Gets the configuration for a logger type.
Definition config.hpp:181
static constexpr Config ConsoleOnly() noexcept
Creates configuration for console-only output.
Definition config.hpp:61

Definition at line 181 of file config.hpp.

◆ LoggerNameOf()

template<LoggerTrait T>
std::string_view helios::log::LoggerNameOf ( T = {})
nodiscardconstexprnoexcept

Gets the name of a logger type.

Returns the name provided by kName variable.

Template Parameters
TLogger type
Parameters
loggerlogger instance
Returns
Name of the logger
struct MyLogger {
static constexpr std::string_view kName = "MyLogger";
};
constexpr auto name = LoggerNameOf<MyLogger>(); // "MyLogger"
constexpr std::string_view LoggerNameOf(T={}) noexcept
Gets the name of a logger type.
Definition config.hpp:158

Definition at line 158 of file config.hpp.

◆ Trace() [1/4]

template<typename... Args>
void helios::log::Trace ( Args && ...)
inlinenoexcept

Definition at line 459 of file logger.hpp.

◆ Trace() [2/4]

void helios::log::Trace ( std::string_view )
inlinenoexcept

Definition at line 456 of file logger.hpp.

◆ Trace() [3/4]

template<LoggerTrait T, typename... Args>
void helios::log::Trace ( T ,
Args && ... )
inlinenoexcept

Definition at line 465 of file logger.hpp.

◆ Trace() [4/4]

template<LoggerTrait T>
void helios::log::Trace ( T ,
std::string_view  )
inlinenoexcept

Definition at line 462 of file logger.hpp.

◆ Warn() [1/4]

template<typename... Args>
requires (sizeof...(Args) > 0)
void helios::log::Warn ( std::format_string< Args... > fmt,
Args &&... args )
inlinenoexcept

Logs a formatted warning message with the default logger.

Template Parameters
ArgsTypes of the format arguments
Parameters
fmtFormat string
argsArguments for the format string

Definition at line 542 of file logger.hpp.

◆ Warn() [2/4]

void helios::log::Warn ( std::string_view message)
inlinenoexcept

Logs a warning message with the default logger.

Parameters
messageThe message to log

Definition at line 530 of file logger.hpp.

◆ Warn() [3/4]

template<LoggerTrait T, typename... Args>
requires (sizeof...(Args) > 0)
void helios::log::Warn ( T logger,
std::format_string< Args... > fmt,
Args &&... args )
inlinenoexcept

Logs a formatted warning message with the specified logger.

Template Parameters
TLogger type
ArgsTypes of the format arguments
Parameters
loggerLogger type instance
fmtFormat string
argsArguments for the format string

Definition at line 567 of file logger.hpp.

◆ Warn() [4/4]

template<LoggerTrait T>
void helios::log::Warn ( T logger,
std::string_view message )
inlinenoexcept

Logs a warning message with the specified logger.

Template Parameters
TLogger type
Parameters
loggerLogger type instance
messageThe message to log

Definition at line 553 of file logger.hpp.

Variable Documentation

◆ kDefaultLogger

DefaultLogger helios::log::kDefaultLogger {}
inlineconstexpr

Constexpr instance of the default logger for easier user interface.

Definition at line 34 of file logger.hpp.