From c36c3468bb39d5a6e95a1072976bbb41f4b96fa1 Mon Sep 17 00:00:00 2001 From: cat Date: Tue, 6 Jan 2026 01:31:00 +0200 Subject: [PATCH] Added warn as a log level, also made error and critical throw --- sourceCode/Systems/Implementation/Logging.cpp | 7 ++++--- sourceCode/Systems/Logging.hpp | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/sourceCode/Systems/Implementation/Logging.cpp b/sourceCode/Systems/Implementation/Logging.cpp index cd6c28d..37f0e30 100644 --- a/sourceCode/Systems/Implementation/Logging.cpp +++ b/sourceCode/Systems/Implementation/Logging.cpp @@ -22,8 +22,8 @@ using namespace Tourmaline::Systems; // This is what happens when it takes you 50 years to implement // reflections to a language -std::array Logging::LogLevelToString{ - "Critical", "Error", "Info", "Debug", "Trace"}; +std::array Logging::LogLevelToString{ + "Critical", "Error", "Warning", "Info", "Debug", "Trace"}; std::fstream Logging::File; void Logging::LogToFile(std::string File) { @@ -53,7 +53,8 @@ void Logging::Log(const std::string &message, const std::string &position, Logging::File.flush(); // Terrible but necessary sadly } - if (severity == Logging::LogLevel::Critical) { + // Error and Critical + if (severity < Logging::LogLevel::Warning) { throw std::runtime_error(output); } } diff --git a/sourceCode/Systems/Logging.hpp b/sourceCode/Systems/Logging.hpp index 093618d..60794d1 100644 --- a/sourceCode/Systems/Logging.hpp +++ b/sourceCode/Systems/Logging.hpp @@ -17,9 +17,10 @@ public: enum class LogLevel { Critical = 0, Error = 1, - Info = 2, - Debug = 3, - Trace = 4 + Warning = 2, + Info = 3, + Debug = 4, + Trace = 5 }; static void LogToFile(std::string File = ""); @@ -29,6 +30,6 @@ public: private: static std::fstream File; - static std::array LogLevelToString; + static std::array LogLevelToString; }; } // namespace Tourmaline::Systems