Files
sonobulus/src/LoggerService.hpp

46 lines
862 B
C++

#pragma once
#include <vector>
#include <string>
#include <fstream>
#include <source_location>
#include "ConfigService.hpp"
enum LogFlag {
Debug,
Info,
Warning,
Error,
Count
};
static constexpr const char* LogFlagStrings[] = {
"Debug",
"Info",
"Warning",
"Error"
};
class LoggerService {
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>
private:
bool standardOutputEnabled_;
bool fileOutputEnabled_;
bool additionaldetailsEnabled_;
bool timeEnabled_;
std::ofstream outfile_;
std::string id_;
std::vector<LogFlag> activeFlags_;
LoggerConfig configuration_;
};