← API Reference Class

asge::logger::Logger

#include <Logger.hpp>

Private Types

#using atomic_ll = std::atomic< LogLevel >private

Private Attributes

#atomic_ll m_Levelprivate
#mutable std::mutex m_Mutexprivate
#mutable signals::Signal< LogRecord const & > m_OnLogprivate

Private Member Functions

#Logger()private

Static Public Member Functions

#static Logger & Instance()

Public Member Functions

#void SetLogLevel(LogLevel inLevel) noexcept
#template<typename ... LArgs> void Log(LogLevel inLevel, char const *inFunction, LArgs &&...args) const noexcept

Log a message to console.

Log the input message to the console if the logging level is at least the current one set to the logger. This function is thread-safe.

If the first argument is string-like (const char*, std::string, std::string_view, ...) and contains "{}" placeholders, the remaining arguments are substituted into them in order, e.g. Log(lvl, fn, "{} of {}", 1, 2) logs "1 of 2". Otherwise every argument is simply concatenated, as before.

Parameters
inLevel

The input level of the input message

inFn

The name of the function calling this log

inMessage

The actual message (or format string) plus any substitution arguments

#signals::Signal< LogRecordconst & >::conn_type OnLogConnect(signals::Signal< LogRecord const & >::slot_type inCallback)

Connects an input callback to the on log signal.