updated logger to support std::format (upgrading to gcc >13 was one of the most tedious things i've ever done)

This commit is contained in:
2026-07-18 03:42:43 -05:00
parent 235530c03d
commit 1c74c04db3
6 changed files with 25 additions and 22 deletions

View File

@@ -4,6 +4,7 @@
#include <string>
#include <fstream>
#include <source_location>
#include <format>
#include "config/ConfigService.hpp"
#include "config/LoggerConfig.hpp"
@@ -30,7 +31,10 @@ public:
LoggerService(ConfigService* config, const std::string& loggerId);
~LoggerService();
void log(std::string component, LogFlag flag, std::string message, std::source_location Source = std::source_location::current()); // Using the <source_location>
template<typename... Args>
void log(std::string component, LogFlag flag, std::format_string<Args...> message, Args&&... args) {
write(component, flag, std::format(message, std::forward<Args>(args)...));
}
private:
@@ -38,4 +42,6 @@ private:
std::vector<LogFlag> activeFlags_;
LoggerParams configuration_;
void write(std::string component, LogFlag flag, std::string message);
};