2025-03-14 19:32:40 +01:00
|
|
|
#pragma once
|
2025-03-17 18:50:31 +01:00
|
|
|
#include <spdlog/common.h>
|
|
|
|
|
#include <spdlog/sinks/basic_file_sink.h>
|
|
|
|
|
#include <spdlog/spdlog.h>
|
|
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
2025-03-14 19:32:40 +01:00
|
|
|
#include "ILog.hpp"
|
|
|
|
|
namespace pixelarium::utils::log
|
|
|
|
|
{
|
2025-09-26 21:09:51 +02:00
|
|
|
/// @brief Implements ILog using the spdlog library
|
|
|
|
|
/// see https://github.com/gabime/spdlog
|
2025-03-14 19:32:40 +01:00
|
|
|
class SpdLogger : public ILog
|
|
|
|
|
{
|
|
|
|
|
public:
|
2025-03-17 18:50:31 +01:00
|
|
|
explicit SpdLogger(const std::string& file_sink, const std::string& name);
|
|
|
|
|
|
2025-08-18 22:39:43 +00:00
|
|
|
void Info(const std::string& msg) const override;
|
|
|
|
|
void Debug(const std::string& msg) const override;
|
|
|
|
|
void Warn(const std::string& msg) const override;
|
|
|
|
|
void Error(const std::string& msg) const override;
|
|
|
|
|
void ChangeLevel(LogLevel lvl) const override;
|
2025-03-14 19:32:40 +01:00
|
|
|
|
2025-03-17 18:50:31 +01:00
|
|
|
private:
|
2025-06-13 22:23:20 +00:00
|
|
|
std::shared_ptr<spdlog::logger> logger_;
|
|
|
|
|
std::string file_;
|
|
|
|
|
std::string name_;
|
2025-03-14 19:32:40 +01:00
|
|
|
};
|
2025-06-13 22:23:20 +00:00
|
|
|
} // namespace pixelarium::utils::log
|