Wrapper for spdlog::logger with additional pattern getter method. More...
Public Member Functions | |
Logger ()=default | |
Creates new empty logger. | |
Logger (const std::string &logger_name, PC_tree_t config, spdlog::level::level_enum level=spdlog::level::info) | |
Creates new logger. | |
Logger (Logger &parent_logger, const std::string &logger_name, PC_tree_t config) | |
Creates new logger with parent logger. | |
void | setup (const std::string &logger_name, PC_tree_t config, spdlog::level::level_enum level=spdlog::level::info) |
Sets up the logger. | |
void | setup (Logger &parent_logger, const std::string &logger_name, PC_tree_t config) |
Sets up the logger with parent logger. | |
void | pattern (const std::string &pattern) |
Changes pattern of the logger. | |
void | global_pattern (const std::string &pattern) |
Changes pattern of the global logger. | |
void | default_pattern (const std::string &pattern) |
Changes default pattern of the logger (won't be updated if current pattern is from config) | |
void | add_pattern_block (const std::string &block) |
Add new element to default pattern. | |
void | add_pattern_global_block (const std::string &block) |
Add new element to default pattern of the global logger. | |
const std::string & | pattern () const |
Returns pattern of the logger. | |
void | level (spdlog::level::level_enum log_level) |
Sets logger level. | |
spdlog::level::level_enum | level () const |
Returns level of the logger. | |
void | evaluate_pattern (Context &ctx) const |
Evaluate pattern. | |
void | evaluate_global_pattern (Context &ctx) const |
Evaluate global pattern. | |
template<typename... Args> | |
void | trace (const char *fmt, Args &&... args) |
Writes trace level message. | |
template<typename... Args> | |
void | debug (const char *fmt, Args &&... args) |
Writes debug level message. | |
template<typename... Args> | |
void | info (const char *fmt, Args &&... args) |
Writes info level message. | |
template<typename... Args> | |
void | warn (const char *fmt, Args &&... args) |
Writes warning level message. | |
template<typename... Args> | |
void | error (const char *fmt, Args &&... args) |
Writes error level message. | |
std::shared_ptr< spdlog::logger > | real_logger () |
Returns real spdlog logger. | |
Wrapper for spdlog::logger with additional pattern getter method.
|
default |
Creates new empty logger.
PDI::Logger::Logger | ( | const std::string & | logger_name, |
PC_tree_t | config, | ||
spdlog::level::level_enum | level = spdlog::level::info |
||
) |
Creates new logger.
[in] | logger_name | logger name that will be displayed |
[in] | config | configuration tree from config file |
[in] | level | default level of the logger |
PDI::Logger::Logger | ( | Logger & | parent_logger, |
const std::string & | logger_name, | ||
PC_tree_t | config | ||
) |
Creates new logger with parent logger.
[in] | parent_logger | the logger to observe if default pattern has changed |
[in] | logger_name | logger name that will be displayed |
[in] | config | configuration tree from config file |
Loggers can inherit block structure from parent_logger. When inherited, pattern and level of the parent will be set as default pattern and level of the child. The pattern and level are inherited if they are not set in child config file. For now it works with plugin loggers. PDI core logger is the parent and plugin logger is the child.
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.
[in] | logger_name | logger name that will be displayed |
[in] | config | configuration tree from config file |
[in] | level | default level of the logger |
void PDI::Logger::setup | ( | Logger & | parent_logger, |
const std::string & | logger_name, | ||
PC_tree_t | config | ||
) |
Sets up the logger with parent logger.
[in] | parent_logger | the logger to observe if default pattern has changed |
[in] | logger_name | logger name that will be displayed |
[in] | config | configuration tree from config file |
void PDI::Logger::pattern | ( | const std::string & | pattern | ) |
Changes pattern of the logger.
[in] | pattern | pattern to set |
void PDI::Logger::global_pattern | ( | const std::string & | pattern | ) |
Changes pattern of the global logger.
[in] | pattern | pattern to set |
The global logger is the logger without a parent.
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)
[in] | pattern | pattern to set |
void PDI::Logger::add_pattern_block | ( | const std::string & | block | ) |
Add new element to default pattern.
[in] | block | new string block to add |
void PDI::Logger::add_pattern_global_block | ( | const std::string & | block | ) |
Add new element to default pattern of the global logger.
[in] | block | new string block to add |
Adds block to the pattern of the global logger.
const std::string & PDI::Logger::pattern | ( | ) | const |
Returns pattern of the logger.
void PDI::Logger::level | ( | spdlog::level::level_enum | log_level | ) |
Sets logger level.
[in] | log_level | level to set |
spdlog::level::level_enum PDI::Logger::level | ( | ) | const |
Returns level of the logger.
void PDI::Logger::evaluate_pattern | ( | Context & | ctx | ) | const |
Evaluate pattern.
[in] | ctx | the context in which to evaluate the pattern |
Evaluation of the pattern.
void PDI::Logger::evaluate_global_pattern | ( | Context & | ctx | ) | const |
Evaluate global pattern.
[in] | ctx | the context in which to evaluate the pattern |
Evaluation of the pattern. Used to evaluate parent and child patterns.
|
inline |
Writes trace level message.
[in] | fmt | fmt formatted string |
[in] | args | arguments for fmt string |
|
inline |
Writes debug level message.
[in] | fmt | fmt formatted string |
[in] | args | arguments for fmt string |
|
inline |
Writes info level message.
[in] | fmt | fmt formatted string |
[in] | args | arguments for fmt string |
|
inline |
Writes warning level message.
[in] | fmt | fmt formatted string |
[in] | args | arguments for fmt string |
|
inline |
Writes error level message.
[in] | fmt | fmt formatted string |
[in] | args | arguments for fmt string |
std::shared_ptr< spdlog::logger > PDI::Logger::real_logger | ( | ) |
Returns real spdlog logger.