Connection to a set of log sinks. More...
#include <log_domain.hpp>
Public Member Functions | |
log_domain (std::string name, log_level_range log_range) | |
std::string | name () const |
void | max_log_level (log_level max_level) |
log_level | max_log_level () const |
void | min_log_level (log_level min_level) |
log_level | min_log_level () const |
void | add_sink (sink_ptr sink) |
void | log (log_level lvl, const std::string &source, const char *message) |
void | clear () |
Static Public Attributes | |
static constexpr const char * | TIMESTAMP_FORMAT = "%Y-%m-%d %H:%M:%S.%f" |
Connection to a set of log sinks.
A log domain is the connection point between a set of log sinks and the logger objects in the user code.
A domain consists of a unique name and a list of sinks
matador::log_domain::log_domain | ( | std::string | name, |
log_level_range | log_range | ||
) |
Creates a log_domain with the given name and the given log range
name | The name of the log domain |
log_range | The log range of this domain |
void matador::log_domain::add_sink | ( | sink_ptr | sink | ) |
Add a sink to the domain.
The sink must be packed into a std::shared_ptr because it can be shared among other domains
sink | The sink to add |
void matador::log_domain::clear | ( | ) |
Clears the list of log sinks
void matador::log_domain::log | ( | log_level | lvl, |
const std::string & | source, | ||
const char * | message | ||
) |
Logs the given message for the given source and log level to this log domain.
lvl | Log level |
source | Source of the log message |
message | Message to log |
log_level matador::log_domain::max_log_level | ( | ) | const |
Returns the max log level
void matador::log_domain::max_log_level | ( | log_level | max_level | ) |
Sets the max log level. Default max leven is LVL_FATAL
max_level | max log level |
log_level matador::log_domain::min_log_level | ( | ) | const |
Returns the min log level
void matador::log_domain::min_log_level | ( | log_level | min_level | ) |
Sets the min log level. Default min leven is LVL_INFO
min_level | min log level |
std::string matador::log_domain::name | ( | ) | const |
Returns the name of the domain
|
staticconstexpr |
The timeformat for each log line