Adrian Hedqvist
bb40711f84
* Add and started using a proper state machine class * Uses a "StateResult" struct to handle state switches * Add timers * Move imgui to its own folder * Add logger (not used yet)
40 lines
896 B
C++
40 lines
896 B
C++
#include "Logger.h"
|
|
#include <SDL2/SDL.h>
|
|
#include <io.h>
|
|
|
|
Log::LogLevel log_level = Log::LogLevel::Warning;
|
|
|
|
void Log::set_log_level(LogLevel level) {
|
|
log_level = level;
|
|
}
|
|
|
|
void Log::error(string tag, string message) {
|
|
if (log_level <= LogLevel::Error) {
|
|
printf("[ERR] <%s> %s\n", tag, message);
|
|
}
|
|
}
|
|
|
|
void Log::warning(string tag, string message) {
|
|
if (log_level <= LogLevel::Warning) {
|
|
printf("[WRN] <%s> %s\n", tag, message);
|
|
}
|
|
}
|
|
|
|
void Log::info(string tag, string message) {
|
|
if (log_level <= LogLevel::Info) {
|
|
printf("[INF] <%s> %s\n", tag, message);
|
|
}
|
|
}
|
|
|
|
void Log::debug(string tag, string message) {
|
|
if (log_level <= LogLevel::Debug) {
|
|
printf("[DBG] <%s> %s\n", tag, message);
|
|
}
|
|
}
|
|
|
|
void Log::trace(string tag, string message) {
|
|
if (log_level <= LogLevel::Trace) {
|
|
printf("[TRC] <%s> %s\n", tag, message);
|
|
}
|
|
}
|