PDI 1.4.3

the PDI data interface

PDI::Logger Class Reference

Wrapper for spdlog::logger with additional pattern getter method. More...

Public Member Functions

 Logger ()=default
 Creates new empty logger. More...
 
 Logger (const std::string &logger_name, PC_tree_t config, spdlog::level::level_enum level=spdlog::level::info)
 Creates new logger. More...
 
 Logger (Logger &parent_logger, const std::string &logger_name, PC_tree_t config)
 Creates new logger with parent logger. More...
 
void setup (const std::string &logger_name, PC_tree_t config, spdlog::level::level_enum level=spdlog::level::info)
 Sets up the logger. More...
 
void setup (Logger &parent_logger, const std::string &logger_name, PC_tree_t config)
 Sets up the logger with parent logger. More...
 
void pattern (const std::string &pattern)
 Changes pattern of the logger. More...
 
void default_pattern (const std::string &pattern)
 Changes default pattern of the logger (won't be updated if current pattern is from config) More...
 
const std::string & pattern () const
 Returns pattern of the logger. More...
 
void level (spdlog::level::level_enum log_level)
 Sets logger level. More...
 
spdlog::level::level_enum level () const
 Returns level of the logger. More...
 
void evaluate_pattern (Context &ctx) const
 Evaluate pattern. More...
 
template<typename... Args>
void trace (const char *fmt, Args &&... args)
 Writes trace level message. More...
 
template<typename... Args>
void debug (const char *fmt, Args &&... args)
 Writes debug level message. More...
 
template<typename... Args>
void info (const char *fmt, Args &&... args)
 Writes info level message. More...
 
template<typename... Args>
void warn (const char *fmt, Args &&... args)
 Writes warning level message. More...
 
template<typename... Args>
void error (const char *fmt, Args &&... args)
 Writes error level message. More...
 
std::shared_ptr< spdlog::logger > real_logger ()
 Returns real spdlog logger. More...
 

Detailed Description

Wrapper for spdlog::logger with additional pattern getter method.

Constructor & Destructor Documentation

◆ Logger() [1/3]

PDI::Logger::Logger ( )
default

Creates new empty logger.

◆ Logger() [2/3]

PDI::Logger::Logger ( const std::string &  logger_name,
PC_tree_t  config,
spdlog::level::level_enum  level = spdlog::level::info 
)

Creates new logger.

Parameters
[in]logger_namelogger name that will be displayed
[in]configconfiguration tree from config file
[in]leveldefault level of the logger

◆ Logger() [3/3]

PDI::Logger::Logger ( Logger parent_logger,
const std::string &  logger_name,
PC_tree_t  config 
)

Creates new logger with parent logger.

Parameters
[in]parent_loggerthe logger to observe if default pattern has changed
[in]logger_namelogger name that will be displayed
[in]configconfiguration tree from config file

Member Function Documentation

◆ setup() [1/2]

void PDI::Logger::setup ( const std::string &  logger_name,
PC_tree_t  config,
spdlog::level::level_enum  level = spdlog::level::info 
)

Sets up the logger.

Parameters
[in]logger_namelogger name that will be displayed
[in]configconfiguration tree from config file
[in]leveldefault level of the logger

◆ setup() [2/2]

void PDI::Logger::setup ( Logger parent_logger,
const std::string &  logger_name,
PC_tree_t  config 
)

Sets up the logger with parent logger.

Parameters
[in]parent_loggerthe logger to observe if default pattern has changed
[in]logger_namelogger name that will be displayed
[in]configconfiguration tree from config file

◆ pattern() [1/2]

void PDI::Logger::pattern ( const std::string &  pattern)

Changes pattern of the logger.

Parameters
[in]patternpattern to set

◆ default_pattern()

void PDI::Logger::default_pattern ( const std::string &  pattern)

Changes default pattern of the logger (won't be updated if current pattern is from config)

Parameters
[in]patternpattern to set

◆ pattern() [2/2]

const std::string& PDI::Logger::pattern ( ) const

Returns pattern of the logger.

Returns
pattern of the logger

◆ level() [1/2]

void PDI::Logger::level ( spdlog::level::level_enum  log_level)

Sets logger level.

Parameters
[in]log_levellevel to set

◆ level() [2/2]

spdlog::level::level_enum PDI::Logger::level ( ) const

Returns level of the logger.

Returns
level of the logger

◆ evaluate_pattern()

void PDI::Logger::evaluate_pattern ( Context ctx) const

Evaluate pattern.

Parameters
[in]ctxthe context in which to evaluate the pattern

◆ trace()

template<typename... Args>
void PDI::Logger::trace ( const char *  fmt,
Args &&...  args 
)
inline

Writes trace level message.

Parameters
[in]fmtfmt formatted string
[in]argsarguments for fmt string

◆ debug()

template<typename... Args>
void PDI::Logger::debug ( const char *  fmt,
Args &&...  args 
)
inline

Writes debug level message.

Parameters
[in]fmtfmt formatted string
[in]argsarguments for fmt string

◆ info()

template<typename... Args>
void PDI::Logger::info ( const char *  fmt,
Args &&...  args 
)
inline

Writes info level message.

Parameters
[in]fmtfmt formatted string
[in]argsarguments for fmt string

◆ warn()

template<typename... Args>
void PDI::Logger::warn ( const char *  fmt,
Args &&...  args 
)
inline

Writes warning level message.

Parameters
[in]fmtfmt formatted string
[in]argsarguments for fmt string

◆ error()

template<typename... Args>
void PDI::Logger::error ( const char *  fmt,
Args &&...  args 
)
inline

Writes error level message.

Parameters
[in]fmtfmt formatted string
[in]argsarguments for fmt string

◆ real_logger()

std::shared_ptr<spdlog::logger> PDI::Logger::real_logger ( )

Returns real spdlog logger.

Returns
spdlog logger

The documentation for this class was generated from the following file: