default logger init

This commit is contained in:
Kueffner, Maximilian
2025-03-17 18:50:31 +01:00
parent ee39b254b4
commit 68cc9d1853
10 changed files with 179 additions and 26 deletions
+35
View File
@@ -0,0 +1,35 @@
#include "SpdLogger.hpp"
#include <spdlog/common.h>
#include <spdlog/spdlog.h>
#include <spdlog/sinks/basic_file_sink.h>
#include <memory>
#include <string>
using namespace pixelarium::utils::log;
SpdLogger::SpdLogger(const std::string& file_sink, const std::string& name)
: _logger(spdlog::basic_logger_mt(file_sink, name)), _file(file_sink), _name(name)
{
spdlog::set_default_logger(this->_logger);
spdlog::flush_on(spdlog::level::info);
_logger->info("Logger initiated");
}
void SpdLogger::Info(const std::string& msg)
{
this->_logger->info(msg);
}
void SpdLogger::Debug(const std::string& msg)
{
this->_logger->debug(msg);
}
void SpdLogger::Warn(const std::string& msg)
{
this->_logger->warn(msg);
}
void SpdLogger::Error(const std::string& msg)
{
this->_logger->error(msg);
}