add some app infrastructure services
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
|
||||
#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_;
|
||||
};
|
||||
Reference in New Issue
Block a user