From ab6841ab85e8b8efca5b6207ed52f750349df8af Mon Sep 17 00:00:00 2001 From: cat Date: Fri, 6 Mar 2026 16:34:53 +0200 Subject: [PATCH] Testing Corrade on Logging --- headers/Systems/Logging.hpp | 7 +++++-- source/Systems/Logging.cpp | 20 ++++++++++++-------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/headers/Systems/Logging.hpp b/headers/Systems/Logging.hpp index 099ea15..18522a7 100644 --- a/headers/Systems/Logging.hpp +++ b/headers/Systems/Logging.hpp @@ -8,7 +8,9 @@ */ #ifndef GUARD_TOURMALINE_LOGGING_H #define GUARD_TOURMALINE_LOGGING_H -#include + +#include "Corrade/Containers/Array.h" + #include #include @@ -31,7 +33,8 @@ public: private: static std::fstream File; - static std::array, 6> + static Corrade::Containers::Array< + std::pair> LogLevelToString; }; } // namespace Tourmaline::Systems diff --git a/source/Systems/Logging.cpp b/source/Systems/Logging.cpp index 292f91b..cf127d0 100644 --- a/source/Systems/Logging.cpp +++ b/source/Systems/Logging.cpp @@ -7,8 +7,10 @@ * obtain one at http://mozilla.org/MPL/2.0/. */ -#include "../../headers/Systems/Logging.hpp" +#include "Systems/Logging.hpp" +#include "Corrade/Containers/Array.h" +#include #include #include #include @@ -24,16 +26,18 @@ #include using namespace Tourmaline::Systems; +using namespace Corrade::Containers; // This is what happens when it takes you 50 years to implement // reflections to a language -std::array, 6> - Logging::LogLevelToString{std::pair{"Critical", "[0;31m"}, - {"Error", "[0;91m"}, - {"Warning", "[0;33m"}, - {"Info", "[0;37m"}, - {"Debug", "[0;92m"}, - {"Trace", "[0;36m"}}; +Array> + Logging::LogLevelToString{Corrade::InPlaceInit, + {std::pair{"Critical", "[0;31m"}, + {"Error", "[0;91m"}, + {"Warning", "[0;33m"}, + {"Info", "[0;37m"}, + {"Debug", "[0;92m"}, + {"Trace", "[0;36m"}}}; std::fstream Logging::File; void Logging::LogToFile(std::string File) {