NRP Logging functions. More...
#include <nrp_logger.h>
Public Types | |
typedef spdlog::level::level_enum | level_t |
The wrapper type for log levels. More... | |
using | spdlog_out_fcn_t = void(&)(const std::string &) |
Logging function type, is used by Exception. More... | |
Public Member Functions | |
NRPLogger (std::string loggerName=_defaultLoggerName.data()) | |
The creation of the configurable instance of spdlog, that is set to default logger, with default settings. More... | |
NRPLogger (std::string loggerName, NRPLogger::level_t fileLogLevel, NRPLogger::level_t consoleLogLevel, std::string logDir, bool doSavePars=false) | |
The creation of the configurable instance of spdlog, that is set to default logger. More... | |
~NRPLogger () | |
void | flush () |
Flush default logger. More... | |
Static Public Member Functions | |
static std::string | level_to_string (const NRPLogger::level_t &level) |
Wrapper function for converting enumed log level into string. More... | |
static NRPLogger::level_t | level_from_string (const std::string &level) |
Wrapper function for getting enumed log level from string. Non-valid string is converted to enum::off. More... | |
static void | shutdownDefault () |
Shutdown default logger. More... | |
static spdlog::logger & | nrpLogger () |
Get default NRPLogger. More... | |
template<typename FormatString , typename... Args> | |
static void | debug (const FormatString &fmt, const Args &...args) |
NRP logging function with message formatting for debug level. More... | |
template<typename FormatString , typename... Args> | |
static void | info (const FormatString &fmt, const Args &...args) |
NRP logging function with message formatting for info level. More... | |
template<typename FormatString , typename... Args> | |
static void | warn (const FormatString &fmt, const Args &...args) |
NRP logging function with message formatting for warning level. More... | |
template<typename FormatString , typename... Args> | |
static void | error (const FormatString &fmt, const Args &...args) |
NRP logging function with message formatting for error level. More... | |
template<typename FormatString , typename... Args> | |
static void | critical (const FormatString &fmt, const Args &...args) |
NRP logging function with message formatting for critical error level. More... | |
template<typename Message > | |
static void | debug (const Message &msg) |
NRP logging function for debug level. More... | |
template<typename Message > | |
static void | info (const Message &msg) |
NRP logging function for info level. More... | |
template<typename Message > | |
static void | warn (const Message &msg) |
NRP logging function for warning level. More... | |
template<typename Message > | |
static void | error (const Message &msg) |
NRP logging function for error level. More... | |
template<typename Message > | |
static void | critical (const Message &msg) |
NRP logging function for critical error level. More... | |
NRP Logging functions.
typedef spdlog::level::level_enum NRPLogger::level_t |
The wrapper type for log levels.
using NRPLogger::spdlog_out_fcn_t = void (&)(const std::string &) |
Logging function type, is used by Exception.
NRPLogger::NRPLogger | ( | std::string | loggerName = _defaultLoggerName.data() | ) |
The creation of the configurable instance of spdlog, that is set to default logger, with default settings.
loggerName | The name of the logger, that is to be displayed in message and placed as log file prefix |
NRPLogger::NRPLogger | ( | std::string | loggerName, |
NRPLogger::level_t | fileLogLevel, | ||
NRPLogger::level_t | consoleLogLevel, | ||
std::string | logDir, | ||
bool | doSavePars = false |
||
) |
The creation of the configurable instance of spdlog, that is set to default logger.
If the \launcher is set true, then the constructor tries to save the logger settings to the shared memory object. Otherwise, the constructor tries to load this settings from the shared memory object. In case of success, these settings are applied to the logger to be created, otherwise the provided settings are used.
loggerName | The name of the logger, that is to be displayed in message and placed as log file prefix |
logDir | The location for the log files |
fileLogLevel | The minimum log level to be put to the log files |
consoleLogLevel | The minimum log level to be printed in console |
doSavePars | Save logger parameters to shared memory or not (load them instaed) |
NRPLogger::~NRPLogger | ( | ) |
|
inlinestatic |
NRP logging function with message formatting for critical error level.
fmt | Message format string in fmt library style https://fmt.dev/latest/index.html |
args | Arguments for substitution into format string #fmt |
|
inlinestatic |
NRP logging function for critical error level.
msg | The message to be logged |
|
inlinestatic |
NRP logging function with message formatting for debug level.
fmt | Message format string in fmt library style https://fmt.dev/latest/index.html |
args | Arguments for substitution into format string #fmt |
|
inlinestatic |
NRP logging function for debug level.
msg | The message to be logged |
|
inlinestatic |
NRP logging function with message formatting for error level.
fmt | Message format string in fmt library style https://fmt.dev/latest/index.html |
args | Arguments for substitution into format string #fmt |
|
inlinestatic |
NRP logging function for error level.
msg | The message to be logged |
void NRPLogger::flush | ( | ) |
Flush default logger.
|
inlinestatic |
NRP logging function with message formatting for info level.
fmt | Message format string in fmt library style https://fmt.dev/latest/index.html |
args | Arguments for substitution into format string #fmt |
|
inlinestatic |
NRP logging function for info level.
msg | The message to be logged |
|
inlinestatic |
Wrapper function for getting enumed log level from string. Non-valid string is converted to enum::off.
level | The string representation of the log level |
|
inlinestatic |
Wrapper function for converting enumed log level into string.
level | The numbered representation of the log level |
|
static |
Get default NRPLogger.
|
static |
Shutdown default logger.
|
inlinestatic |
NRP logging function with message formatting for warning level.
fmt | Message format string in fmt library style https://fmt.dev/latest/index.html |
args | Arguments for substitution into format string #fmt |
|
inlinestatic |
NRP logging function for warning level.
msg | The message to be logged |