You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
709 B

#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;
};