Simple-Log
alpha-v0.7
|
Convenience class for generating Record s. More...
#include <Logger.hpp>
Public Types | |
using | Record_t = std::remove_cvref_t< TRecord > |
using | RecordSetters_t = RecordSetters< Record_t > |
using | SeverityLevel_t = RecordSeverity_t< Record_t > |
using | Channel_t = RecordChannel_t< Record_t > |
using | RecordBuilder_t = RecordBuilder< Record_t > |
using | LogCallback_t = std::function< void(Record_t)> |
Public Member Functions | |
BaseLogger (LogCallback_t logCallback, SeverityLevel_t defaultSeverityLvl={}, Channel_t defaultChannel={}) noexcept | |
Constructor. More... | |
~BaseLogger () noexcept=default | |
Destructor. More... | |
BaseLogger (const BaseLogger &) noexcept=default | |
Copy constructor. More... | |
BaseLogger & | operator= (const BaseLogger &) noexcept=default |
Copy-assign operator. More... | |
BaseLogger (BaseLogger &&) noexcept=default | |
Move constructor. More... | |
BaseLogger & | operator= (BaseLogger &&) noexcept=default |
Move-assign operator. More... | |
RecordBuilder_t | operator() () |
Creates a new instance of RecordBuilder. More... | |
template<std::convertible_to< SeverityLevel_t > USeverityLevel> | |
void | setDefaultSeverity (USeverityLevel &&sevLvl) noexcept |
Setter for the default severity level. More... | |
const SeverityLevel_t & | defaultSeverity () const noexcept |
Getter for the default severity level. More... | |
template<std::convertible_to< Channel_t > UChannel> | |
void | setDefaultChannel (UChannel &&channel) noexcept |
Setter for the default channel. More... | |
const Channel_t & | defaultChannel () const noexcept |
Getter for the default channel. More... | |
Related Functions | |
(Note that these are not member functions.) | |
template<Logger TLogger, class... TArgs> | |
TLogger | makeLogger (Core< LoggerRecord_t< TLogger >> &core, TArgs &&... args) |
Creates a Logger object and setup its callback to the given Core instance. More... | |
Convenience class for generating Record s.
TRecord | Used Record type. |
This class is in fact a template for upcoming Record s. It stores default settings (e.g. severity level and channel) for newly generated Record s. Using its operator () users can start building Record s in an effective and elegant manner. Logger instances are rather lightweight, thus could be instantiated on class level, but it is also fine using the same instance in the whole program.
using sl::log::BaseLogger< TRecord >::Channel_t = RecordChannel_t<Record_t> |
using sl::log::BaseLogger< TRecord >::LogCallback_t = std::function<void(Record_t)> |
using sl::log::BaseLogger< TRecord >::Record_t = std::remove_cvref_t<TRecord> |
using sl::log::BaseLogger< TRecord >::RecordBuilder_t = RecordBuilder<Record_t> |
using sl::log::BaseLogger< TRecord >::RecordSetters_t = RecordSetters<Record_t> |
using sl::log::BaseLogger< TRecord >::SeverityLevel_t = RecordSeverity_t<Record_t> |
|
inlineexplicitnoexcept |
Constructor.
Creates a Logger instance and links it to the specified core instance
logCallback | Callback which will receive created Records. |
defaultSeverityLvl | Default severity level for generated Records. |
defaultChannel | Default channel for generated Records. |
|
defaultnoexcept |
Destructor.
|
defaultnoexcept |
Copy constructor.
|
defaultnoexcept |
Move constructor.
|
inlinenoexcept |
Getter for the default channel.
|
inlinenoexcept |
Getter for the default severity level.
|
inline |
Creates a new instance of RecordBuilder.
This is the entry point for producing new Record s. The returned RecordBuilder object will be pre-initialized with each values set to Logger's default, which might be overriden during the Record building process.
|
defaultnoexcept |
Move-assign operator.
|
defaultnoexcept |
Copy-assign operator.
|
inlinenoexcept |
Setter for the default channel.
channel | New default value |
|
inlinenoexcept |
Setter for the default severity level.
sevLvl | New default value |