Some machinations on a config structure as well as a restructure on how

I do logging.
This commit is contained in:
MitchellHansen
2017-09-23 01:06:20 -07:00
parent 2f1adca75d
commit 86f1622090
14 changed files with 1490 additions and 398 deletions

34
include/Logger.h Normal file
View 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;
};