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::logging::Log Class Referencefinal

Sink based logging system. More...

#include <Log.hpp>

+ Collaboration diagram for galaxy::logging::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::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 40 of file Log.hpp.

Constructor & Destructor Documentation

◆ Log() [1/3]

galaxy::logging::Log::Log ( )
noexcept

Constructor.

Definition at line 16 of file Log.cpp.

◆ ~Log()

galaxy::logging::Log::~Log ( )
noexcept

Destructor.

Definition at line 22 of file Log.cpp.

◆ Log() [2/3]

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

Copy constructor.

◆ Log() [3/3]

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

Move constructor.

Member Function Documentation

◆ add_sink()

template<std::derived_from< Sink > SinkTo, typename... Args>
SinkTo & galaxy::logging::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 124 of file Log.hpp.

◆ set_min_level()

template<LogLevel level>
void galaxy::logging::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 132 of file Log.hpp.

◆ log()

template<LogLevel level, typename... MsgInputs>
void galaxy::logging::Log::log ( 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
locSource location argument.
messageMessage template to log.
argsstd::format supported arguments to be formatted into a string.

Definition at line 138 of file Log.hpp.

+ Here is the call graph for this function:

◆ operator=() [1/2]

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

Copy assignment operator.

◆ operator=() [2/2]

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

Move assignment operator.

Member Data Documentation

◆ m_min_level

LogLevel galaxy::logging::Log::m_min_level
private

Minimum level for a message to be logged.

Definition at line 115 of file Log.hpp.

◆ m_sinks

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

List of sinks.

Definition at line 120 of file Log.hpp.


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