The MAUVE Toolchain
mauve::runtime::AbstractLogger Class Referenceabstract

Class of a generic MAUVE logger. More...

#include <logger.hpp>

Inheritance diagram for mauve::runtime::AbstractLogger:

Public Member Functions

 AbstractLogger ()
 Constructor.
 
virtual ~AbstractLogger ()
 Destructor.
 
template<typename... Args>
void critical (const char *fmt, const Args &...args)
 Log a message at CRITICAL level. More...
 
template<typename... Args>
void debug (const char *fmt, const Args &...args)
 Log a message at DEBUG level. More...
 
template<typename... Args>
void error (const char *fmt, const Args &...args)
 Log a message at ERROR level. More...
 
template<typename... Args>
void info (const char *fmt, const Args &...args)
 Log a message at INFO level. More...
 
template<typename... Args>
void trace (const char *fmt, const Args &...args)
 Log a message at TRACE level. More...
 
template<typename... Args>
void warn (const char *fmt, const Args &...args)
 Log a message at WARN level. More...
 

Static Public Member Functions

static void clear ()
 Clear all loggers information.
 
static AbstractLoggerget_logger (const std::string &name)
 Get a logger by its name. More...
 
static void initialize ()
 Initialize the logging framework with default parameters.
 
static void initialize (std::istream &is)
 Initialize the logging framework from an input stream. More...
 
static void initialize (const std::string &s)
 Initialize the logging framework from a string. More...
 
static void initialize (const YAML::Node &n)
 Initialize the logging framework from a YAML node. More...
 

Protected Member Functions

virtual std::string name ()=0
 Get Logger category name. More...
 
virtual std::string prepend (const char *fmt)=0
 Prepend log message with contextual data. More...
 

Static Protected Member Functions

static spdlog::level::level_enum level_enum (const std::string &lvl)
 Convert a string to a log level. More...
 

Static Protected Attributes

static std::shared_ptr< spdlog::logger > default_logger_
 Default logger when no category specified.
 
static std::map< std::string, std::vector< std::shared_ptr< spdlog::logger > > > loggers
 Store spdlog loggers associated to the categories.
 

Detailed Description

Class of a generic MAUVE logger.

Member Function Documentation

template<typename... Args>
void mauve::runtime::AbstractLogger::critical ( const char *  fmt,
const Args &...  args 
)

Log a message at CRITICAL level.

Template Parameters
Argsmessage arguments type
Parameters
fmtformatted message
argsmessage arguments
template<typename... Args>
void mauve::runtime::AbstractLogger::debug ( const char *  fmt,
const Args &...  args 
)

Log a message at DEBUG level.

Template Parameters
Argsmessage arguments type
Parameters
fmtformatted message
argsmessage arguments
template<typename... Args>
void mauve::runtime::AbstractLogger::error ( const char *  fmt,
const Args &...  args 
)

Log a message at ERROR level.

Template Parameters
Argsmessage arguments type
Parameters
fmtformatted message
argsmessage arguments
static AbstractLogger* mauve::runtime::AbstractLogger::get_logger ( const std::string &  name)
static

Get a logger by its name.

Parameters
namethe logger name
Returns
a pointer to the logger with name name, or to a null logger if unregistered
template<typename... Args>
void mauve::runtime::AbstractLogger::info ( const char *  fmt,
const Args &...  args 
)

Log a message at INFO level.

Template Parameters
Argsmessage arguments type
Parameters
fmtformatted message
argsmessage arguments
static void mauve::runtime::AbstractLogger::initialize ( std::istream &  is)
static

Initialize the logging framework from an input stream.

Parameters
isthe input stream containing formatted parameters
static void mauve::runtime::AbstractLogger::initialize ( const std::string &  s)
static

Initialize the logging framework from a string.

Parameters
sthe input string containing formatted parameters
static void mauve::runtime::AbstractLogger::initialize ( const YAML::Node &  n)
static

Initialize the logging framework from a YAML node.

Parameters
isthe input YAML configuration
static spdlog::level::level_enum mauve::runtime::AbstractLogger::level_enum ( const std::string &  lvl)
staticprotected

Convert a string to a log level.

Parameters
lvla string notation of the level
Returns
a spdlog level.
virtual std::string mauve::runtime::AbstractLogger::name ( )
protectedpure virtual

Get Logger category name.

Returns
the category name attached to this logger

Implemented in mauve::runtime::DeployerLogger, mauve::runtime::ResourceLogger, mauve::runtime::ComponentLogger, and mauve::runtime::CategoryLogger.

virtual std::string mauve::runtime::AbstractLogger::prepend ( const char *  fmt)
protectedpure virtual

Prepend log message with contextual data.

Parameters
fmtthe original message
Returns
a new message with component data

Implemented in mauve::runtime::DeployerLogger, mauve::runtime::ResourceLogger, mauve::runtime::ComponentLogger, and mauve::runtime::CategoryLogger.

template<typename... Args>
void mauve::runtime::AbstractLogger::trace ( const char *  fmt,
const Args &...  args 
)

Log a message at TRACE level.

Template Parameters
Argsmessage arguments type
Parameters
fmtformatted message
argsmessage arguments
template<typename... Args>
void mauve::runtime::AbstractLogger::warn ( const char *  fmt,
const Args &...  args 
)

Log a message at WARN level.

Template Parameters
Argsmessage arguments type
Parameters
fmtformatted message
argsmessage arguments