matador::log_domain Class Reference

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"
 

Detailed Description

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

Constructor & Destructor Documentation

◆ log_domain()

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

Parameters
nameThe name of the log domain
log_rangeThe log range of this domain

Member Function Documentation

◆ add_sink()

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

Parameters
sinkThe sink to add

◆ clear()

void matador::log_domain::clear ( )

Clears the list of log sinks

◆ log()

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.

Parameters
lvlLog level
sourceSource of the log message
messageMessage to log

◆ max_log_level() [1/2]

log_level matador::log_domain::max_log_level ( ) const

Returns the max log level

Returns
The max log level

◆ max_log_level() [2/2]

void matador::log_domain::max_log_level ( log_level  max_level)

Sets the max log level. Default max leven is LVL_FATAL

Parameters
max_levelmax log level

◆ min_log_level() [1/2]

log_level matador::log_domain::min_log_level ( ) const

Returns the min log level

Returns
The min log level

◆ min_log_level() [2/2]

void matador::log_domain::min_log_level ( log_level  min_level)

Sets the min log level. Default min leven is LVL_INFO

Parameters
min_levelmin log level

◆ name()

std::string matador::log_domain::name ( ) const

Returns the name of the domain

Returns
The name of the domain

Member Data Documentation

◆ TIMESTAMP_FORMAT

constexpr const char* matador::log_domain::TIMESTAMP_FORMAT = "%Y-%m-%d %H:%M:%S.%f"
staticconstexpr

The timeformat for each log line


The documentation for this class was generated from the following file:
  • matador/logger/log_domain.hpp