maliput
|
A logger class implementation.
Logger will dump all messages to a sink (SinkBase) which will be in charge of serializing the messages to the appropriate channel. By default, Sink implementation is used.
It provides six different log levels, logger::level , which can be filtered based on the severity of the message.
Comments about the design:
#include <include/maliput/common/logger.h>
Public Member Functions | |
MALIPUT_NO_COPY_NO_MOVE_NO_ASSIGN (Logger) | |
Logger ()=default | |
template<typename... Args> | |
void | trace (const Args &... args) |
Log the message showing trace level prefix. More... | |
template<typename... Args> | |
void | debug (const Args &... args) |
Log the message showing debug level prefix. More... | |
template<typename... Args> | |
void | info (const Args &... args) |
Log the message showing info level prefix. More... | |
template<typename... Args> | |
void | warn (const Args &... args) |
Log the message showing warning level prefix. More... | |
template<typename... Args> | |
void | error (const Args &... args) |
Log the message showing error level prefix. More... | |
template<typename... Args> | |
void | critical (const Args &... args) |
Log the message showing critical level prefix. More... | |
void | set_sink (std::unique_ptr< common::SinkBase > sink) |
Set a sink. More... | |
SinkBase * | get_sink () |
Get the current sink. More... | |
std::string | set_level (logger::level log_level) |
Sets the minimum level of messages to be logged. More... | |
Static Public Attributes | |
static constexpr int | kNumberOfArguments {100} |
Indicates the maximum number of arguments that a single log command is able to process. More... | |
Related Functions | |
(Note that these are not member functions.) | |
std::string | set_log_level (const std::string &level) |
Invokes maliput::log()->set_level(level) . More... | |
common::Logger * | log () |
Retrieve an instance of a logger to use for logger. More... | |
|
default |
SinkBase* get_sink | ( | ) |
Get the current sink.
MALIPUT_NO_COPY_NO_MOVE_NO_ASSIGN | ( | Logger | ) |
std::string set_level | ( | logger::level | log_level | ) |
Sets the minimum level of messages to be logged.
log_level | Must be a level enum value from the level enumerations: trace , debug , info , warning , error , critical or off . |
void set_sink | ( | std::unique_ptr< common::SinkBase > | sink | ) |
Set a sink.
sink | Is a SinkBase implementation. |
common::assertion_error | When sink is nullptr. |
|
related |
Retrieve an instance of a logger to use for logger.
See Logger.
|
related |
Invokes maliput::log()->set_level(level)
.
See Logger.
level | Must be a string from the level enumerations: trace , debug , info , warning , error , critical or off . |
std::out_of_range | When level is not one of the predefined values. |
|
staticconstexpr |
Indicates the maximum number of arguments that a single log command is able to process.