diff --git a/Bigfoot/Sources/System/Include/System/Log/Log.hpp b/Bigfoot/Sources/System/Include/System/Log/Log.hpp index 37c7800..63943f1 100644 --- a/Bigfoot/Sources/System/Include/System/Log/Log.hpp +++ b/Bigfoot/Sources/System/Include/System/Log/Log.hpp @@ -68,6 +68,12 @@ class Log */ void ChangeLoggerLogLevel(LoggerInfo& p_loggerInfo, const Flat::LogLevel p_level); + /* + * Flush all the loggers + * + */ + void Flush(); + ~Log(); Log& operator=(const Log& p_logger) = delete; diff --git a/Bigfoot/Sources/System/Log/Log.cpp b/Bigfoot/Sources/System/Log/Log.cpp index 4162610..ea0635e 100644 --- a/Bigfoot/Sources/System/Log/Log.cpp +++ b/Bigfoot/Sources/System/Log/Log.cpp @@ -79,6 +79,16 @@ void Log::SetLoggerLevel(const LoggerInfo& p_loggerInfo) /****************************************************************************************/ +void Log::Flush() +{ + for (quill::Logger* logger: quill::Frontend::get_all_loggers()) + { + logger->flush_log(); + } +} + +/****************************************************************************************/ + Log::~Log() { for (quill::Logger* logger: quill::Frontend::get_all_loggers()) diff --git a/Bigfoot/Sources/Utils/Include/Utils/Assert.hpp b/Bigfoot/Sources/Utils/Include/Utils/Assert.hpp index 4bdefc2..69975ec 100644 --- a/Bigfoot/Sources/Utils/Include/Utils/Assert.hpp +++ b/Bigfoot/Sources/Utils/Include/Utils/Assert.hpp @@ -4,8 +4,9 @@ * \author Romain BOULLARD * \date October 2025 *********************************************************************/ -#ifndef BIGFOOT_UTILS_ASSERT_HPP -#define BIGFOOT_UTILS_ASSERT_HPP +#ifndef BIGFOOT_SYSTEM_ASSERT_HPP +#define BIGFOOT_SYSTEM_ASSERT_HPP +#include #if defined BIGFOOT_NOT_OPTIMIZED @@ -79,6 +80,10 @@ }; \ \ HANDLER::Handle(location, stacktrace(), p_message __VA_OPT__(, ) __VA_ARGS__); \ + if (Bigfoot::Singleton::HasInstance()) \ + { \ + Bigfoot::Singleton::Instance().Flush(); \ + } \ BREAK; \ std::abort(); \ } \ diff --git a/Bigfoot/Sources/Utils/Include/Utils/Singleton.hpp b/Bigfoot/Sources/Utils/Include/Utils/Singleton.hpp index 1d6fa9f..b954882 100644 --- a/Bigfoot/Sources/Utils/Include/Utils/Singleton.hpp +++ b/Bigfoot/Sources/Utils/Include/Utils/Singleton.hpp @@ -35,6 +35,16 @@ class Singleton return *eastl::bit_cast(ms_instance.data()); } + /** + * Is the instance initialized + * + * \return True if initialized, false otherwise + */ + static constexpr bool HasInstance() + { + return ms_initialized; + } + class Lifetime { public: