1#ifndef LOGGING_LOGGER_H
2#define LOGGING_LOGGER_H
38#ifndef LINTEL_FUNCTION
40#define LINTEL_FUNCTION __FUNCSIG__
41#elif defined(__GNUC__) || defined(__clang__)
42#define LINTEL_FUNCTION __PRETTY_FUNCTION__
44#define LINTEL_FUNCTION __func__
53 std::shared_ptr<ProcessName> m_processName;
54 std::shared_ptr<Configuration> m_configuration;
55 std::shared_ptr<spdlog::logger> m_logger;
58 std::shared_ptr<spdlog::logger> init();
64 void logImpl(
const char *
file,
68 std::string_view message,
69 std::format_args
args);
71 static std::unique_ptr<LoggerService> m_instance;
72 static std::mutex m_instanceMutex;
116 template<
typename...
Args>
123#define DECLARE_LOGGER(processName, configuration) lintel::LoggerService::getOrCreate(processName, configuration)
124#define LOG_INFO(message, ...) \
125 lintel::LoggerService::get().log(__FILE__, __LINE__, LINTEL_FUNCTION, lintel::LogLevel::info, message, ##__VA_ARGS__)
126#define LOG_DEBUG(message, ...) \
127 lintel::LoggerService::get().log(__FILE__, __LINE__, LINTEL_FUNCTION, lintel::LogLevel::debug, message, ##__VA_ARGS__)
128#define LOG_TRACE(message, ...) \
129 lintel::LoggerService::get().log(__FILE__, __LINE__, LINTEL_FUNCTION, lintel::LogLevel::trace, message, ##__VA_ARGS__)
130#define LOG_ERROR(message, ...) \
131 lintel::LoggerService::get().log(__FILE__, __LINE__, LINTEL_FUNCTION, lintel::LogLevel::error, message, ##__VA_ARGS__)
132#define LOG_FATAL(message, ...) \
133 lintel::LoggerService::get().log( \
134 __FILE__, __LINE__, LINTEL_FUNCTION, lintel::LogLevel::critical, message, ##__VA_ARGS__)
135#define LOG_WARN(message, ...) \
136 lintel::LoggerService::get().log(__FILE__, __LINE__, LINTEL_FUNCTION, lintel::LogLevel::warn, message, ##__VA_ARGS__)
Definition LoggerService.h:50
LoggerService(std::shared_ptr< ProcessName > processName, std::shared_ptr< Configuration > configuration)
static LoggerService & get()
void log(const char *file, int line, const char *function, LogLevel lvl, std::string_view message, Args &&...args)
Definition LoggerService.h:117
static void initSingleton(const std::shared_ptr< ProcessName > &processInfo, const std::shared_ptr< Configuration > &configuration)
static void initSingleton2()
static LoggerService & getOrCreate(const std::shared_ptr< ProcessName > &processInfo, const std::shared_ptr< Configuration > &configuration)
Definition BaseFeature.h:6
LogLevel
Definition LoggerService.h:35
constexpr std::string_view type_name()
Definition TypeName.h:9
Definition LoggerService.h:25