Roms list properly handle sorting + use ircolib's log so i can stop worrying about re-definition of macros and shit

This commit is contained in:
2026-06-15 17:06:15 +02:00
parent 642fc17391
commit cf0378719c
53 changed files with 3131 additions and 3079 deletions
+61
View File
@@ -0,0 +1,61 @@
#pragma once
#include <print>
#include <ircolib/types.hpp>
namespace ircolib {
enum LogLevel : u8 { Trace, Debug, Info, Warn, Error, Always };
constexpr LogLevel globalLogLevel = Warn;
template <typename... Args>
void panic(std::format_string<Args...> fmt, Args &&...args) {
std::print("[FATAL] ");
std::println(fmt, std::forward<Args>(args)...);
exit(1);
}
template <typename... Args>
void error(std::format_string<Args...> fmt, Args &&...args) {
if (LogLevel::Error >= globalLogLevel) {
std::print("[ERROR] ");
std::println(fmt, std::forward<Args>(args)...);
}
}
template <typename... Args>
void warn(std::format_string<Args...> fmt, Args &&...args) {
if (LogLevel::Warn >= globalLogLevel) {
std::print("[WARN] ");
std::println(fmt, std::forward<Args>(args)...);
}
}
template <typename... Args>
void info(std::format_string<Args...> fmt, Args &&...args) {
if (LogLevel::Info >= globalLogLevel) {
std::print("[INFO] ");
std::println(fmt, std::forward<Args>(args)...);
}
}
template <typename... Args>
void debug(std::format_string<Args...> fmt, Args &&...args) {
if (LogLevel::Debug >= globalLogLevel) {
std::print("[DEBUG] ");
std::println(fmt, std::forward<Args>(args)...);
}
}
template <typename... Args>
void trace(std::format_string<Args...> fmt, Args &&...args) {
if (LogLevel::Trace >= globalLogLevel) {
std::print("[TRACE] ");
std::println(fmt, std::forward<Args>(args)...);
}
}
template <typename... Args>
void always(std::format_string<Args...> fmt, Args &&...args) {
std::println(fmt, std::forward<Args>(args)...);
}
} // namespace ircolib