code: Initial Commit

This commit is contained in:
Vaxry
2025-04-12 20:06:56 +01:00
parent cf925610f4
commit fdc616ac69
23 changed files with 1349 additions and 0 deletions

36
src/debug/log.hpp Normal file
View File

@@ -0,0 +1,36 @@
#pragma once
#include <string>
#include <fmt/format.h>
#include <iostream>
enum LogLevel {
NONE = -1,
LOG = 0,
WARN,
ERR,
CRIT,
INFO,
TRACE
};
namespace Debug {
template <typename... Args>
void log(LogLevel level, fmt::format_string<Args...> fmt, Args&&... args) {
std::string logMsg = "";
switch (level) {
case LOG: logMsg += "[LOG] "; break;
case WARN: logMsg += "[WARN] "; break;
case ERR: logMsg += "[ERR] "; break;
case CRIT: logMsg += "[CRITICAL] "; break;
case INFO: logMsg += "[INFO] "; break;
case TRACE: logMsg += "[TRACE] "; break;
default: break;
}
logMsg += fmt::vformat(fmt.get(), fmt::make_format_args(args...));
std::cout << logMsg << "\n";
}
};