Go to the documentation of this file.
25 #ifdef PRODUCTION_RELEASE
26 #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_DEBUG
28 #define SPDLOG_TRACE_ON
29 #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE
32 #include <spdlog/spdlog.h>
34 #include <semaphore.h>
39 #define NRP_LOGGER_TRACE(...) SPDLOG_TRACE(__VA_ARGS__)
52 typedef spdlog::level::level_enum
level_t;
59 std::string loggerName = _defaultLoggerName.data());
75 std::string loggerName,
79 bool doSavePars =
false);
89 return spdlog::level::to_string_view(level).data();
98 return spdlog::level::from_str(level);
126 template <
typename FormatString,
typename... Args>
127 static void debug(
const FormatString &fmt,
const Args &...
args)
129 spdlog::default_logger()->log(spdlog::level::debug, fmt,
args...);
137 template <
typename FormatString,
typename... Args>
138 static void info(
const FormatString &fmt,
const Args &...
args)
140 spdlog::default_logger()->log(spdlog::level::info, fmt,
args...);
148 template <
typename FormatString,
typename... Args>
149 static void warn(
const FormatString &fmt,
const Args &...
args)
151 spdlog::default_logger()->log(spdlog::level::warn, fmt,
args...);
159 template <
typename FormatString,
typename... Args>
160 static void error(
const FormatString &fmt,
const Args &...
args)
162 spdlog::default_logger()->log(spdlog::level::err, fmt,
args...);
170 template <
typename FormatString,
typename... Args>
173 spdlog::default_logger()->log(spdlog::level::critical, fmt,
args...);
180 template <
typename Message>
181 static void debug(
const Message &msg)
183 spdlog::default_logger()->log(spdlog::level::debug, msg);
190 template <
typename Message>
191 static void info(
const Message &msg)
193 spdlog::default_logger()->log(spdlog::level::info, msg);
200 template <
typename Message>
201 static void warn(
const Message &msg)
203 spdlog::default_logger()->log(spdlog::level::warn, msg);
210 template <
typename Message>
211 static void error(
const Message &msg)
213 spdlog::default_logger()->log(spdlog::level::err, msg);
220 template <
typename Message>
223 spdlog::default_logger()->log(spdlog::level::critical, msg);
230 static constexpr std::string_view _defaultLoggerName =
"nrp_core";
235 std::string _baseFilename;
240 std::string _loggerName;
270 static constexpr std::string_view _defaultLogDir =
"log";
275 static constexpr std::string_view _sharedMemCfgName =
"/NRPLogger";
289 void registerDefaultLogger();
295 bool setSharedMemoryForLauncher();
301 bool getSharedMemoryFromLauncher();
308 bool shutdownSharedMemory(
int& fd);
313 struct LoggerConfig {
316 uint consoleLogLevel;
322 #endif // NRP_LOGGER_H
void flush()
Flush default logger.
Definition: nrp_logger.cpp:321
static void warn(const FormatString &fmt, const Args &...args)
NRP logging function with message formatting for warning level.
Definition: nrp_logger.h:149
static std::string level_to_string(const NRPLogger::level_t &level)
Wrapper function for converting enumed log level into string.
Definition: nrp_logger.h:87
~NRPLogger()
Definition: nrp_logger.cpp:307
static void debug(const Message &msg)
NRP logging function for debug level.
Definition: nrp_logger.h:181
Namespace args
Definition: python_json_engine.py:196
static void info(const Message &msg)
NRP logging function for info level.
Definition: nrp_logger.h:191
void(&)(const std::string &) spdlog_out_fcn_t
Logging function type, is used by Exception.
Definition: nrp_logger.h:119
static void info(const FormatString &fmt, const Args &...args)
NRP logging function with message formatting for info level.
Definition: nrp_logger.h:138
static void critical(const Message &msg)
NRP logging function for critical error level.
Definition: nrp_logger.h:221
NRP Logging functions.
Definition: nrp_logger.h:45
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...
Definition: nrp_logger.h:96
NRPLogger(std::string loggerName=_defaultLoggerName.data())
The creation of the configurable instance of spdlog, that is set to default logger,...
Definition: nrp_logger.cpp:149
static void shutdownDefault()
Shutdown default logger.
Definition: nrp_logger.cpp:325
static spdlog::logger & nrpLogger()
Get default NRPLogger.
static void critical(const FormatString &fmt, const Args &...args)
NRP logging function with message formatting for critical error level.
Definition: nrp_logger.h:171
static void error(const FormatString &fmt, const Args &...args)
NRP logging function with message formatting for error level.
Definition: nrp_logger.h:160
spdlog::level::level_enum level_t
The wrapper type for log levels.
Definition: nrp_logger.h:52
static void error(const Message &msg)
NRP logging function for error level.
Definition: nrp_logger.h:211
static void debug(const FormatString &fmt, const Args &...args)
NRP logging function with message formatting for debug level.
Definition: nrp_logger.h:127
static void warn(const Message &msg)
NRP logging function for warning level.
Definition: nrp_logger.h:201