Some machinations on a config structure as well as a restructure on how
I do logging.
This commit is contained in:
34
include/Logger.h
Normal file
34
include/Logger.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#undef ERROR
|
||||
|
||||
class Logger {
|
||||
|
||||
public:
|
||||
|
||||
enum LogLevel { INFO, WARN, ERROR };
|
||||
enum LogDest { STDOUT, FILE };
|
||||
|
||||
// Log auto, takes a string and the severity of the log level and either prints it or tosses it
|
||||
static void log(std::string log_string, LogLevel severity, uint32_t line_number = 0, char* file_name = nullptr);
|
||||
|
||||
static void set_log_level(LogLevel log_level);
|
||||
static void set_log_destination(LogDest log_destination);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
Logger() {};
|
||||
~Logger() {
|
||||
log_file.close();
|
||||
};
|
||||
|
||||
static bool open_log_file();
|
||||
static std::ostream& get_stream();
|
||||
|
||||
static LogDest log_destination;
|
||||
static LogLevel log_level;
|
||||
static std::ofstream log_file;
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user