2020-11-18 12:15:14 +02:00
|
|
|
#pragma once
|
|
|
|
|
#include <spdlog/spdlog.h>
|
2020-11-18 20:25:20 +02:00
|
|
|
#include "logger_settings.h"
|
2020-11-18 12:15:14 +02:00
|
|
|
|
|
|
|
|
class Logger
|
|
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
|
std::shared_ptr<spdlog::logger> logger;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
Logger();
|
|
|
|
|
Logger(std::string loggerName, std::wstring logFilePath, std::wstring_view logSettingsPath);
|
|
|
|
|
|
2020-11-18 20:25:20 +02:00
|
|
|
// log message should not be localized
|
2020-11-18 12:15:14 +02:00
|
|
|
template<typename FormatString, typename... Args>
|
|
|
|
|
void trace(const FormatString& fmt, const Args&... args)
|
|
|
|
|
{
|
|
|
|
|
this->logger->trace(fmt, args...);
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-18 20:25:20 +02:00
|
|
|
// log message should not be localized
|
2020-11-18 12:15:14 +02:00
|
|
|
template<typename FormatString, typename... Args>
|
|
|
|
|
void debug(const FormatString& fmt, const Args&... args)
|
|
|
|
|
{
|
|
|
|
|
this->logger->debug(fmt, args...);
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-18 20:25:20 +02:00
|
|
|
// log message should not be localized
|
2020-11-18 12:15:14 +02:00
|
|
|
template<typename FormatString, typename... Args>
|
|
|
|
|
void info(const FormatString& fmt, const Args&... args)
|
|
|
|
|
{
|
|
|
|
|
this->logger->info(fmt, args...);
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-18 20:25:20 +02:00
|
|
|
// log message should not be localized
|
2020-11-18 12:15:14 +02:00
|
|
|
template<typename FormatString, typename... Args>
|
|
|
|
|
void warn(const FormatString& fmt, const Args&... args)
|
|
|
|
|
{
|
|
|
|
|
this->logger->warn(fmt, args...);
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-18 20:25:20 +02:00
|
|
|
// log message should not be localized
|
2020-11-18 12:15:14 +02:00
|
|
|
template<typename FormatString, typename... Args>
|
|
|
|
|
void error(const FormatString& fmt, const Args&... args)
|
|
|
|
|
{
|
|
|
|
|
this->logger->error(fmt, args...);
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-18 20:25:20 +02:00
|
|
|
// log message should not be localized
|
2020-11-18 12:15:14 +02:00
|
|
|
template<typename FormatString, typename... Args>
|
|
|
|
|
void critical(const FormatString& fmt, const Args&... args)
|
|
|
|
|
{
|
|
|
|
|
this->logger->critical(fmt, args...);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
~Logger();
|
|
|
|
|
};
|