From 290d282d28b76a634044d2bf8b688a79e4be2c2b Mon Sep 17 00:00:00 2001 From: Xavier Mitault Date: Wed, 4 Oct 2023 00:14:01 +0200 Subject: [PATCH 1/5] ECS: Add logger MINOR --- src/ECS/CMakeLists.txt | 1 + src/ECS/Logger.cpp | 158 +++++++++++++++++++++++++++++++++++++++++ src/ECS/Logger.hpp | 131 ++++++++++++++++++++++++++++++++++ src/ECS/Registry.hpp | 4 ++ 4 files changed, 294 insertions(+) create mode 100644 src/ECS/Logger.cpp create mode 100644 src/ECS/Logger.hpp diff --git a/src/ECS/CMakeLists.txt b/src/ECS/CMakeLists.txt index 148889f0..fe67fea1 100644 --- a/src/ECS/CMakeLists.txt +++ b/src/ECS/CMakeLists.txt @@ -13,4 +13,5 @@ target_sources( PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Registry.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Clock.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Logger.cpp ) diff --git a/src/ECS/Logger.cpp b/src/ECS/Logger.cpp new file mode 100644 index 00000000..d684c763 --- /dev/null +++ b/src/ECS/Logger.cpp @@ -0,0 +1,158 @@ +/* +** EPITECH PROJECT, 2023 +** Raytracer +** File description: +** Logger.cpp +*/ + +#include "Logger.hpp" +#include +#include +#include +#include + +namespace Logger { + Logger::Logger(int logLevel) : _logLevel(logLevel) + { + } + + void Logger::fatal(const std::string &message) + { + if (_logLevel < _LOG_FATAL_VALUE) { + return; + } + Logger::print(_LOG_FATAL_VALUE, "FATAL", message); + } + + void Logger::error(const std::string &message) + { + if (_logLevel < _LOG_ERROR_VALUE) { + return; + } + Logger::print(_LOG_ERROR_VALUE, "ERROR", message); + } + + void Logger::warn(const std::string &message) + { + if (_logLevel < _LOG_WARN_VALUE) { + return; + } + Logger::print(_LOG_WARN_VALUE, "WARN", message); + } + + void Logger::info(const std::string &message) + { + if (_logLevel < _LOG_INFO_VALUE) { + return; + } + Logger::print(_LOG_INFO_VALUE, "INFO", message); + } + + void Logger::debug(const std::string &message) + { +#ifdef NDEBUG + return; +#else + if (_logLevel < _LOG_DEBUG_VALUE) { + return; + } + Logger::print(_LOG_DEBUG_VALUE, "DEBUG", message); +#endif + } + + void Logger::trace(const std::string &message) + { +#ifdef NDEBUG + return; +#else + if (_logLevel < _LOG_TRACE_VALUE) { + return; + } + Logger::print(_LOG_TRACE_VALUE, "TRACE", message); +#endif + } + + void Logger::print( + int levelT, + const std::string &level, + const std::string &message) + { +#ifdef __linux__ + static std::map colors = { + {_LOG_FATAL_VALUE, "\033[31m"}, + {_LOG_ERROR_VALUE, "\033[33m"}, + {_LOG_WARN_VALUE, "\033[34m"}, + {_LOG_INFO_VALUE, "\033[32m"}, + {_LOG_DEBUG_VALUE, "\033[38m"}, + {_LOG_TRACE_VALUE, "\033[30m"}, + {_LOG_RESET_COLOR, "\033[0m" }, + }; +#elif __APPLE__ + static std::map colors = { + {_LOG_FATAL_VALUE, "\033[31m"}, + {_LOG_ERROR_VALUE, "\033[33m"}, + {_LOG_WARN_VALUE, "\033[34m"}, + {_LOG_INFO_VALUE, "\033[32m"}, + {_LOG_DEBUG_VALUE, "\033[38m"}, + {_LOG_TRACE_VALUE, "\033[30m"}, + {_LOG_RESET_COLOR, "\033[0m" }, + }; +#else + static std::map colors = + { + {_LOG_FATAL_VALUE, ""}, + {_LOG_ERROR_VALUE, ""}, + {_LOG_WARN_VALUE, ""}, + {_LOG_INFO_VALUE, ""}, + {_LOG_DEBUG_VALUE, ""}, + {_LOG_TRACE_VALUE, ""}, + {_LOG_RESET_COLOR, ""}, + } +#endif + + std::time_t rawtime = 0; + struct tm *timeinfo = nullptr; + std::string time; + std::string mes; + auto it = _callbacks.find(levelT); + + std::time(&rawtime); + timeinfo = std::localtime(&rawtime); + time = std::asctime(timeinfo); + time.erase(time.find_last_of("\n")); + mes = time + " [" + level + "] " + message; + std::cerr << colors[levelT] << mes << colors[_LOG_RESET_COLOR] + << std::endl; + if (it != _callbacks.end()) { + for (auto &it1 : it->second) { + it1.second(mes); + } + } + } + + void Logger::subscribeCallback( + int type, + const std::string &name, + std::function callback) + { + if (_callbacks.find(type) == _callbacks.end()) { + _callbacks.emplace( + type, + std::map< + std::string, + std::function>()); + } + _callbacks[type].emplace(name, callback); + } + + void Logger::unsubscribeCallback(int type, const std::string &name) + { + if (_callbacks.find(type) == _callbacks.end()) { + return; + } + if (_callbacks[type].find(name) == _callbacks[type].end()) { + return; + } + _callbacks[type].erase(name); + } +} // namespace Logger diff --git a/src/ECS/Logger.hpp b/src/ECS/Logger.hpp new file mode 100644 index 00000000..5a09553c --- /dev/null +++ b/src/ECS/Logger.hpp @@ -0,0 +1,131 @@ +/* +** EPITECH PROJECT, 2023 +** Raytracer +** File description: +** Logger.hpp +*/ + +#pragma once + +#include +#include +#include + +#define _LOG_FATAL_VALUE 0 +#define _LOG_ERROR_VALUE 1 +#define _LOG_WARN_VALUE 2 +#define _LOG_INFO_VALUE 3 +#define _LOG_DEBUG_VALUE 4 +#define _LOG_TRACE_VALUE 5 +#define _LOG_RESET_COLOR 6 + +namespace Logger { + /** + * @brief Logger singleton + * + * LogLevel: + * -1 - no messages + * 0 - only `fatal` are displayed + * 1 - `error` and `fatal` are displayed + * 2 - `warn`, `error` and `fatal` are displayed + * 3 - `info`, `warn`, `error` and `fatal` are displayed + * 4 - `debug`, `info`, `warn`, `error` and `fatal` are displayed + * 5 - `trace`, `debug`, `info`, `warn`, `error` and `fatal` are displayed + * + * Attention: + * `debug` and `trace` will only do something in debug mode compilation. + * (`set(CMAKE_BUILD_TYPE Debug)` in `CMakeLists.txt`) + */ + class Logger { + public: + Logger(int logLevel = _LOG_WARN_VALUE); + /** + * @brief Logger fata + * + * Means that something critical is broken, and the application + * cannot continue to do any more useful work without the + * intervention of an engineer. + * + * @param message the message + */ + void fatal(const std::string &message); + /** + * @brief Logger error + * + * The ERROR log level is used to represent error conditions in + * an application that prevent a specific operation from running, + * but the application itself can continue working even if it is + * at a reduced level of functionality or performance. + * + * @param message the message + */ + void error(const std::string &message); + /** + * @brief Logger warn + * + * Messages logged at the WARN level typically indicate that + * something unexpected happened, but the application can recover + * and continue to function normally. + * + * @param message the message + */ + void warn(const std::string &message); + /** + * @brief Logger info + * + * INFO-level messages indicate events in the system that are + * significant to the business purpose of the application. Such + * events are logged to show that the system is operating normally. + * + * @param message the message + */ + void info(const std::string &message); + /** + * @brief Logger debug + * + * The DEBUG level is used for logging messages that help + * developers find out what went wrong during a debugging session. + * + * @param message the message + */ + void debug(const std::string &message); + /** + * @brief Logger trace + * + * The TRACE level is used for tracing the path of code execution + * in a program. + * + * @param message the message + */ + void trace(const std::string &message); + /** + * @brief Logger subscribe + * + * @param type the type to subscribe for + * @param name the name + * @param callback the callback + */ + void subscribeCallback( + int type, + const std::string &name, + std::function callback); + /** + * @brief Logger remove + * + * @param type the type + * @param name the name + */ + void unsubscribeCallback(int type, const std::string &name); + + private: + void print( + int levelT, + const std::string &level, + const std::string &message); + std::map< + int, + std::map>> + _callbacks; + int _logLevel; + }; +} // namespace Logger diff --git a/src/ECS/Registry.hpp b/src/ECS/Registry.hpp index e2114355..6577316e 100644 --- a/src/ECS/Registry.hpp +++ b/src/ECS/Registry.hpp @@ -17,6 +17,7 @@ #include #include #include "Clock.hpp" +#include "Logger.hpp" #include "SceneManager.hpp" #include "SparseArray.hpp" @@ -76,10 +77,13 @@ class Registry { Clock &getClock(); + Logger::Logger &getLogger(); + private: Registry(); Clock _clock; + Logger::Logger _logger; void initLayers(bool back); From 92eaee0cde2c3fa1d812dad1420a936903b24469 Mon Sep 17 00:00:00 2001 From: Xavier Mitault Date: Wed, 4 Oct 2023 12:07:27 +0200 Subject: [PATCH 2/5] ECS: Fix comment pr PATCH --- src/ECS/Logger.cpp | 130 +++++++++++++++++++++++++++---------------- src/ECS/Logger.hpp | 66 ++++++++++++++-------- src/ECS/Registry.cpp | 5 ++ src/main_client.cpp | 2 + 4 files changed, 133 insertions(+), 70 deletions(-) diff --git a/src/ECS/Logger.cpp b/src/ECS/Logger.cpp index d684c763..865870d0 100644 --- a/src/ECS/Logger.cpp +++ b/src/ECS/Logger.cpp @@ -6,46 +6,76 @@ */ #include "Logger.hpp" +#include #include +#include #include #include +#include #include +#include + namespace Logger { - Logger::Logger(int logLevel) : _logLevel(logLevel) + void fatal(const std::string &message) + { + Registry::getInstance().getLogger().fatal(message); + } + void error(const std::string &message) + { + Registry::getInstance().getLogger().error(message); + } + void warn(const std::string &message) + { + Registry::getInstance().getLogger().warn(message); + } + void info(const std::string &message) + { + Registry::getInstance().getLogger().info(message); + } + void debug(const std::string &message) + { + Registry::getInstance().getLogger().debug(message); + } + void trace(const std::string &message) + { + Registry::getInstance().getLogger().trace(message); + } + + Logger::Logger(LogLevel logLevel) : _logLevel(logLevel) { } void Logger::fatal(const std::string &message) { - if (_logLevel < _LOG_FATAL_VALUE) { + if (_logLevel < LogLevel::Fatal) { return; } - Logger::print(_LOG_FATAL_VALUE, "FATAL", message); + Logger::print(LogLevel::Fatal, "FATAL", message); } void Logger::error(const std::string &message) { - if (_logLevel < _LOG_ERROR_VALUE) { + if (_logLevel < LogLevel::Error) { return; } - Logger::print(_LOG_ERROR_VALUE, "ERROR", message); + Logger::print(LogLevel::Error, "ERROR", message); } void Logger::warn(const std::string &message) { - if (_logLevel < _LOG_WARN_VALUE) { + if (_logLevel < LogLevel::Warn) { return; } - Logger::print(_LOG_WARN_VALUE, "WARN", message); + Logger::print(LogLevel::Warn, "WARN", message); } void Logger::info(const std::string &message) { - if (_logLevel < _LOG_INFO_VALUE) { + if (_logLevel < LogLevel::Info) { return; } - Logger::print(_LOG_INFO_VALUE, "INFO", message); + Logger::print(LogLevel::Info, "INFO", message); } void Logger::debug(const std::string &message) @@ -53,10 +83,10 @@ namespace Logger { #ifdef NDEBUG return; #else - if (_logLevel < _LOG_DEBUG_VALUE) { + if (_logLevel < LogLevel::Debug) { return; } - Logger::print(_LOG_DEBUG_VALUE, "DEBUG", message); + Logger::print(LogLevel::Debug, "DEBUG", message); #endif } @@ -65,63 +95,57 @@ namespace Logger { #ifdef NDEBUG return; #else - if (_logLevel < _LOG_TRACE_VALUE) { + if (_logLevel < LogLevel::Trace) { return; } - Logger::print(_LOG_TRACE_VALUE, "TRACE", message); + Logger::print(LogLevel::Trace, "TRACE", message); #endif } void Logger::print( - int levelT, + LogLevel levelT, const std::string &level, const std::string &message) { #ifdef __linux__ - static std::map colors = { - {_LOG_FATAL_VALUE, "\033[31m"}, - {_LOG_ERROR_VALUE, "\033[33m"}, - {_LOG_WARN_VALUE, "\033[34m"}, - {_LOG_INFO_VALUE, "\033[32m"}, - {_LOG_DEBUG_VALUE, "\033[38m"}, - {_LOG_TRACE_VALUE, "\033[30m"}, - {_LOG_RESET_COLOR, "\033[0m" }, + static std::map colors = { + {LogLevel::Fatal, "\033[31m"}, + {LogLevel::Error, "\033[33m"}, + {LogLevel::Warn, "\033[34m"}, + {LogLevel::Info, "\033[32m"}, + {LogLevel::Debug, "\033[38m"}, + {LogLevel::Trace, "\033[30m"}, + {LogLevel::MAXLOGLEVEL, "\033[0m" }, }; #elif __APPLE__ static std::map colors = { - {_LOG_FATAL_VALUE, "\033[31m"}, - {_LOG_ERROR_VALUE, "\033[33m"}, - {_LOG_WARN_VALUE, "\033[34m"}, - {_LOG_INFO_VALUE, "\033[32m"}, - {_LOG_DEBUG_VALUE, "\033[38m"}, - {_LOG_TRACE_VALUE, "\033[30m"}, - {_LOG_RESET_COLOR, "\033[0m" }, + {LogLevel::Fatal, "\033[31m"}, + {LogLevel::Error, "\033[33m"}, + {LogLevel::Warn, "\033[34m"}, + {LogLevel::Info, "\033[32m"}, + {LogLevel::Debug, "\033[38m"}, + {LogLevel::Trace, "\033[30m"}, + {LogLevel::MAXLOGLEVEL, "\033[0m" }, }; #else static std::map colors = { - {_LOG_FATAL_VALUE, ""}, - {_LOG_ERROR_VALUE, ""}, - {_LOG_WARN_VALUE, ""}, - {_LOG_INFO_VALUE, ""}, - {_LOG_DEBUG_VALUE, ""}, - {_LOG_TRACE_VALUE, ""}, - {_LOG_RESET_COLOR, ""}, - } + {LogLevel::Fatal,""}, + {LogLevel::Error,""}, + {LogLevel::Warn, ""}, + {LogLevel::Info, ""}, + {LogLevel::Debug,""}, + {LogLevel::Trace,""}, + {LogLevel::MAXLOG""}, + }; #endif - std::time_t rawtime = 0; - struct tm *timeinfo = nullptr; - std::string time; + auto const now = std::chrono::current_zone()->to_local(std::chrono::system_clock::now()); std::string mes; auto it = _callbacks.find(levelT); - std::time(&rawtime); - timeinfo = std::localtime(&rawtime); - time = std::asctime(timeinfo); - time.erase(time.find_last_of("\n")); - mes = time + " [" + level + "] " + message; - std::cerr << colors[levelT] << mes << colors[_LOG_RESET_COLOR] + mes = std::format("{:%Y-%m-%d %H:%M:%S}", now) + " [" + level + "] " + message; + std::cerr << colors[levelT] << mes << colors[LogLevel::MAXLOGLEVEL] << std::endl; if (it != _callbacks.end()) { for (auto &it1 : it->second) { @@ -131,7 +155,7 @@ namespace Logger { } void Logger::subscribeCallback( - int type, + LogLevel type, const std::string &name, std::function callback) { @@ -145,7 +169,7 @@ namespace Logger { _callbacks[type].emplace(name, callback); } - void Logger::unsubscribeCallback(int type, const std::string &name) + void Logger::unsubscribeCallback(LogLevel type, const std::string &name) { if (_callbacks.find(type) == _callbacks.end()) { return; @@ -155,4 +179,14 @@ namespace Logger { } _callbacks[type].erase(name); } + + void Logger::setLogLevel(LogLevel logLevel) + { + _logLevel = logLevel; + } + + LogLevel Logger::getLogLevel() const + { + return _logLevel; + } } // namespace Logger diff --git a/src/ECS/Logger.hpp b/src/ECS/Logger.hpp index 5a09553c..ffb4ff65 100644 --- a/src/ECS/Logger.hpp +++ b/src/ECS/Logger.hpp @@ -11,26 +11,36 @@ #include #include -#define _LOG_FATAL_VALUE 0 -#define _LOG_ERROR_VALUE 1 -#define _LOG_WARN_VALUE 2 -#define _LOG_INFO_VALUE 3 -#define _LOG_DEBUG_VALUE 4 -#define _LOG_TRACE_VALUE 5 -#define _LOG_RESET_COLOR 6 - namespace Logger { + enum class LogLevel : int { + NOLOG = -1, + Fatal = 0, + Error = 1, + Warn = 2, + Info = 3, + Debug = 4, + Trace = 5, + MAXLOGLEVEL = 6, + }; + + void fatal(const std::string &message); + void error(const std::string &message); + void warn(const std::string &message); + void info(const std::string &message); + void debug(const std::string &message); + void trace(const std::string &message); + /** - * @brief Logger singleton + * @brief Logger * * LogLevel: - * -1 - no messages - * 0 - only `fatal` are displayed - * 1 - `error` and `fatal` are displayed - * 2 - `warn`, `error` and `fatal` are displayed - * 3 - `info`, `warn`, `error` and `fatal` are displayed - * 4 - `debug`, `info`, `warn`, `error` and `fatal` are displayed - * 5 - `trace`, `debug`, `info`, `warn`, `error` and `fatal` are displayed + * LogLevel::NOLOG - no messages + * LogLevel::Fatal - only `fatal` are displayed + * LogLevel::Error - `error` and `fatal` are displayed + * LogLevel::Warn - `warn`, `error` and `fatal` are displayed + * LogLevel::Info - `info`, `warn`, `error` and `fatal` are displayed + * LogLevel::Debug - `debug`, `info`, `warn`, `error` and `fatal` are displayed + * LogLevel::Trace - `trace`, `debug`, `info`, `warn`, `error` and `fatal` are displayed * * Attention: * `debug` and `trace` will only do something in debug mode compilation. @@ -38,7 +48,7 @@ namespace Logger { */ class Logger { public: - Logger(int logLevel = _LOG_WARN_VALUE); + Logger(LogLevel logLevel = LogLevel::Info); /** * @brief Logger fata * @@ -106,7 +116,7 @@ namespace Logger { * @param callback the callback */ void subscribeCallback( - int type, + LogLevel type, const std::string &name, std::function callback); /** @@ -115,17 +125,29 @@ namespace Logger { * @param type the type * @param name the name */ - void unsubscribeCallback(int type, const std::string &name); + void unsubscribeCallback(LogLevel type, const std::string &name); + /** + * @brief set log level + * + * @param logLevel the log level + */ + void setLogLevel(LogLevel logLevel); + /** + * @brief get log level + * + * @return the log level + */ + [[nodiscard]] LogLevel getLogLevel() const; private: void print( - int levelT, + LogLevel levelT, const std::string &level, const std::string &message); std::map< - int, + LogLevel, std::map>> _callbacks; - int _logLevel; + LogLevel _logLevel; }; } // namespace Logger diff --git a/src/ECS/Registry.cpp b/src/ECS/Registry.cpp index 63a58dd9..e2db65c0 100644 --- a/src/ECS/Registry.cpp +++ b/src/ECS/Registry.cpp @@ -148,3 +148,8 @@ Clock &Registry::getClock() { return _clock; } + +Logger::Logger &Registry::getLogger() +{ + return _logger; +} diff --git a/src/main_client.cpp b/src/main_client.cpp index 161985de..80d60e32 100644 --- a/src/main_client.cpp +++ b/src/main_client.cpp @@ -6,11 +6,13 @@ */ #include "SceneManager.hpp" +#include "Logger.hpp" int main() { SceneManager &sceneManager = SceneManager::getInstance(); + Logger::info("Starting Game..."); int res = sceneManager.run(); return res; From 3dadf0a7434309e969ec4fff68caa5d5a901df26 Mon Sep 17 00:00:00 2001 From: Github Actions Date: Wed, 4 Oct 2023 10:09:08 +0000 Subject: [PATCH 3/5] FORMAT-AUTO: automatic format on pull request #44 --- src/ECS/Logger.cpp | 47 +++++++++++++++++++++++---------------------- src/ECS/Logger.hpp | 19 +++++++++--------- src/main_client.cpp | 2 +- 3 files changed, 35 insertions(+), 33 deletions(-) diff --git a/src/ECS/Logger.cpp b/src/ECS/Logger.cpp index 865870d0..32816c0f 100644 --- a/src/ECS/Logger.cpp +++ b/src/ECS/Logger.cpp @@ -109,42 +109,43 @@ namespace Logger { { #ifdef __linux__ static std::map colors = { - {LogLevel::Fatal, "\033[31m"}, - {LogLevel::Error, "\033[33m"}, - {LogLevel::Warn, "\033[34m"}, - {LogLevel::Info, "\033[32m"}, - {LogLevel::Debug, "\033[38m"}, - {LogLevel::Trace, "\033[30m"}, + {LogLevel::Fatal, "\033[31m"}, + {LogLevel::Error, "\033[33m"}, + {LogLevel::Warn, "\033[34m"}, + {LogLevel::Info, "\033[32m"}, + {LogLevel::Debug, "\033[38m"}, + {LogLevel::Trace, "\033[30m"}, {LogLevel::MAXLOGLEVEL, "\033[0m" }, }; #elif __APPLE__ static std::map colors = { - {LogLevel::Fatal, "\033[31m"}, - {LogLevel::Error, "\033[33m"}, - {LogLevel::Warn, "\033[34m"}, - {LogLevel::Info, "\033[32m"}, - {LogLevel::Debug, "\033[38m"}, - {LogLevel::Trace, "\033[30m"}, + {LogLevel::Fatal, "\033[31m"}, + {LogLevel::Error, "\033[33m"}, + {LogLevel::Warn, "\033[34m"}, + {LogLevel::Info, "\033[32m"}, + {LogLevel::Debug, "\033[38m"}, + {LogLevel::Trace, "\033[30m"}, {LogLevel::MAXLOGLEVEL, "\033[0m" }, }; #else - static std::map colors = - { - {LogLevel::Fatal,""}, - {LogLevel::Error,""}, - {LogLevel::Warn, ""}, - {LogLevel::Info, ""}, - {LogLevel::Debug,""}, - {LogLevel::Trace,""}, - {LogLevel::MAXLOG""}, + static std::map colors = { + {LogLevel::Fatal, ""}, + {LogLevel::Error, ""}, + {LogLevel::Warn,""}, + {LogLevel::Info, ""}, + {LogLevel::Debug, ""}, + {LogLevel::Trace, ""}, + {LogLevel::MAXLOG ""}, }; #endif - auto const now = std::chrono::current_zone()->to_local(std::chrono::system_clock::now()); + auto const now = std::chrono::current_zone()->to_local( + std::chrono::system_clock::now()); std::string mes; auto it = _callbacks.find(levelT); - mes = std::format("{:%Y-%m-%d %H:%M:%S}", now) + " [" + level + "] " + message; + mes = std::format("{:%Y-%m-%d %H:%M:%S}", now) + " [" + level + "] " + + message; std::cerr << colors[levelT] << mes << colors[LogLevel::MAXLOGLEVEL] << std::endl; if (it != _callbacks.end()) { diff --git a/src/ECS/Logger.hpp b/src/ECS/Logger.hpp index ffb4ff65..ba56849a 100644 --- a/src/ECS/Logger.hpp +++ b/src/ECS/Logger.hpp @@ -13,13 +13,13 @@ namespace Logger { enum class LogLevel : int { - NOLOG = -1, - Fatal = 0, - Error = 1, - Warn = 2, - Info = 3, - Debug = 4, - Trace = 5, + NOLOG = -1, + Fatal = 0, + Error = 1, + Warn = 2, + Info = 3, + Debug = 4, + Trace = 5, MAXLOGLEVEL = 6, }; @@ -39,8 +39,9 @@ namespace Logger { * LogLevel::Error - `error` and `fatal` are displayed * LogLevel::Warn - `warn`, `error` and `fatal` are displayed * LogLevel::Info - `info`, `warn`, `error` and `fatal` are displayed - * LogLevel::Debug - `debug`, `info`, `warn`, `error` and `fatal` are displayed - * LogLevel::Trace - `trace`, `debug`, `info`, `warn`, `error` and `fatal` are displayed + * LogLevel::Debug - `debug`, `info`, `warn`, `error` and `fatal` are + * displayed LogLevel::Trace - `trace`, `debug`, `info`, `warn`, `error` and + * `fatal` are displayed * * Attention: * `debug` and `trace` will only do something in debug mode compilation. diff --git a/src/main_client.cpp b/src/main_client.cpp index 80d60e32..2f633bf8 100644 --- a/src/main_client.cpp +++ b/src/main_client.cpp @@ -5,8 +5,8 @@ ** main */ -#include "SceneManager.hpp" #include "Logger.hpp" +#include "SceneManager.hpp" int main() { From 71d1ac45c52f8d9abcb8ddc7f844f6c4c13d2f8a Mon Sep 17 00:00:00 2001 From: Xavier Mitault Date: Wed, 4 Oct 2023 12:11:31 +0200 Subject: [PATCH 4/5] ECS: Remove double include in .cpp --- src/ECS/Logger.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/ECS/Logger.cpp b/src/ECS/Logger.cpp index 32816c0f..e1aedb47 100644 --- a/src/ECS/Logger.cpp +++ b/src/ECS/Logger.cpp @@ -5,16 +5,12 @@ ** Logger.cpp */ -#include "Logger.hpp" #include #include #include #include -#include -#include -#include - -#include +#include "Registry.hpp" +#include "Logger.hpp" namespace Logger { void fatal(const std::string &message) From a1f793acbe99ade6de360985fadb56125a0517b7 Mon Sep 17 00:00:00 2001 From: Github Actions Date: Wed, 4 Oct 2023 10:12:40 +0000 Subject: [PATCH 5/5] FORMAT-AUTO: automatic format on pull request #44 --- src/ECS/Logger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ECS/Logger.cpp b/src/ECS/Logger.cpp index e1aedb47..39521adf 100644 --- a/src/ECS/Logger.cpp +++ b/src/ECS/Logger.cpp @@ -5,12 +5,12 @@ ** Logger.cpp */ +#include "Logger.hpp" #include #include #include #include #include "Registry.hpp" -#include "Logger.hpp" namespace Logger { void fatal(const std::string &message)