Small fixes and improvements

This commit is contained in:
SimoneN64
2024-05-26 22:11:14 +02:00
parent f6afa56987
commit bbac4e315e
4 changed files with 14 additions and 9 deletions

View File

@@ -9,7 +9,7 @@
namespace Util {
enum LogLevel : u8 {
Trace, Debug, Info, Warn, Error
Trace, Debug, Info, Warn, Error, Always
};
#ifndef NDEBUG
@@ -26,7 +26,7 @@ constexpr void print(const std::string& fmt, Args... args) {
fmt::print(fmt::emphasis::bold | fg(fmt::color::red), fmt, args...);
} else if constexpr(messageType == Warn) {
fmt::print(fg(fmt::color::yellow), fmt, args...);
} else if constexpr(messageType == Info || messageType == Trace) {
} else if constexpr(messageType == Info || messageType == Trace || messageType == Always) {
fmt::print(fmt, args...);
} else if constexpr(messageType == Debug) {
#ifndef NDEBUG
@@ -76,6 +76,11 @@ constexpr void trace(const std::string& fmt, Args... args) {
print<Trace>("[TRACE] " + fmt + "\n", args...);
}
template <typename ...Args>
constexpr void always(const std::string& fmt, Args... args) {
print<Always>(fmt + "\n", args...);
}
template <typename ...Args>
constexpr void panic_trace(const std::string& fmt, Args... args) {
#if !defined(NDEBUG) && !defined(_WIN32)