#pragma once #include #include namespace ircolib { enum LogLevel : u8 { Trace, Debug, Info, Warn, Error, Always }; constexpr LogLevel globalLogLevel = Warn; template void panic(std::format_string fmt, Args &&...args) { std::print("[FATAL] "); std::println(fmt, std::forward(args)...); exit(1); } template void error(std::format_string fmt, Args &&...args) { if (LogLevel::Error >= globalLogLevel) { std::print("[ERROR] "); std::println(fmt, std::forward(args)...); } } template void warn(std::format_string fmt, Args &&...args) { if (LogLevel::Warn >= globalLogLevel) { std::print("[WARN] "); std::println(fmt, std::forward(args)...); } } template void info(std::format_string fmt, Args &&...args) { if (LogLevel::Info >= globalLogLevel) { std::print("[INFO] "); std::println(fmt, std::forward(args)...); } } template void debug(std::format_string fmt, Args &&...args) { if (LogLevel::Debug >= globalLogLevel) { std::print("[DEBUG] "); std::println(fmt, std::forward(args)...); } } template void trace(std::format_string fmt, Args &&...args) { if (LogLevel::Trace >= globalLogLevel) { std::print("[TRACE] "); std::println(fmt, std::forward(args)...); } } template void always(std::format_string fmt, Args &&...args) { std::println(fmt, std::forward(args)...); } } // namespace ircolib