galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
galaxy::Log Class Referencefinal

Sink based logging system. More...

#include <Log.hpp>

+ Collaboration diagram for galaxy::Log:

Public Member Functions

 Log () noexcept
 Constructor.
 
 ~Log () noexcept
 Destructor.
 
template<std::derived_from< Sink > SinkTo, typename... Args>
SinkTo & add_sink (Args &&... args)
 Add a sink to log to.
 
template<LogLevel level>
void set_min_level () noexcept
 Set a minimum log level.
 
template<LogLevel level, typename... MsgInputs>
void log (const std::stacktrace &trace, const std::source_location &loc, std::string_view message, const MsgInputs &... args)
 Log a message.
 

Private Member Functions

 Log (const Log &)=delete
 Copy constructor.
 
 Log (Log &&)=delete
 Move constructor.
 
Logoperator= (const Log &)=delete
 Copy assignment operator.
 
Logoperator= (Log &&)=delete
 Move assignment operator.
 

Private Attributes

LogLevel m_min_level
 Minimum level for a message to be logged.
 
std::vector< std::unique_ptr< Sink > > m_sinks
 List of sinks.
 

Detailed Description

Sink based logging system.

Use macros to access.

Definition at line 37 of file Log.hpp.

Constructor & Destructor Documentation

◆ Log() [1/3]

galaxy::Log::Log ( )
noexcept

Constructor.

Definition at line 14 of file Log.cpp.

◆ ~Log()

galaxy::Log::~Log ( )
noexcept

Destructor.

Definition at line 20 of file Log.cpp.

◆ Log() [2/3]

galaxy::Log::Log ( const Log & )
privatedelete

Copy constructor.

◆ Log() [3/3]

galaxy::Log::Log ( Log && )
privatedelete

Move constructor.

Member Function Documentation

◆ add_sink()

template<std::derived_from< Sink > SinkTo, typename... Args>
SinkTo & galaxy::Log::add_sink ( Args &&... args)
inline

Add a sink to log to.

Template Parameters
SinkToThe derived type of the sink.
ArgsVariadic arguments for sink constructor.
Parameters
argsConstructor arguments for a sink. Can be blank.
Returns
A pointer to the newly created sink.

Definition at line 122 of file Log.hpp.

◆ set_min_level()

template<LogLevel level>
void galaxy::Log::set_min_level ( )
inlinenoexcept

Set a minimum log level.

In order to only print and log levels greater than or equal to the current log message level.

Template Parameters
levelMust be a LogLevel enum value.

Definition at line 130 of file Log.hpp.

◆ log()

template<LogLevel level, typename... MsgInputs>
void galaxy::Log::log ( const std::stacktrace & trace,
const std::source_location & loc,
std::string_view message,
const MsgInputs &... args )
inline

Log a message.

Template Parameters
levelMust be a LogLevel enum value.
MsgInputsVariadic arguments for std::format string.
Parameters
traceStacktrace for error.
locSource location argument.
messageMessage template to log.
argsstd::format supported arguments to be formatted into a string.

Definition at line 136 of file Log.hpp.

+ Here is the call graph for this function:

◆ operator=() [1/2]

Log & galaxy::Log::operator= ( const Log & )
privatedelete

Copy assignment operator.

◆ operator=() [2/2]

Log & galaxy::Log::operator= ( Log && )
privatedelete

Move assignment operator.

Member Data Documentation

◆ m_min_level

LogLevel galaxy::Log::m_min_level
private

Minimum level for a message to be logged.

Definition at line 113 of file Log.hpp.

◆ m_sinks

std::vector<std::unique_ptr<Sink> > galaxy::Log::m_sinks
private

List of sinks.

Definition at line 118 of file Log.hpp.


The documentation for this class was generated from the following files: