Log before std::abort

This commit is contained in:
2026-01-28 18:56:28 +01:00
parent e78d648178
commit 1775e864b4
4 changed files with 33 additions and 2 deletions

View File

@@ -68,6 +68,12 @@ class Log
*/ */
void ChangeLoggerLogLevel(LoggerInfo& p_loggerInfo, const Flat::LogLevel p_level); void ChangeLoggerLogLevel(LoggerInfo& p_loggerInfo, const Flat::LogLevel p_level);
/*
* Flush all the loggers
*
*/
void Flush();
~Log(); ~Log();
Log& operator=(const Log& p_logger) = delete; Log& operator=(const Log& p_logger) = delete;

View File

@@ -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() Log::~Log()
{ {
for (quill::Logger* logger: quill::Frontend::get_all_loggers()) for (quill::Logger* logger: quill::Frontend::get_all_loggers())

View File

@@ -4,8 +4,9 @@
* \author Romain BOULLARD * \author Romain BOULLARD
* \date October 2025 * \date October 2025
*********************************************************************/ *********************************************************************/
#ifndef BIGFOOT_UTILS_ASSERT_HPP #ifndef BIGFOOT_SYSTEM_ASSERT_HPP
#define BIGFOOT_UTILS_ASSERT_HPP #define BIGFOOT_SYSTEM_ASSERT_HPP
#include <System/Log/Log.hpp>
#if defined BIGFOOT_NOT_OPTIMIZED #if defined BIGFOOT_NOT_OPTIMIZED
@@ -79,6 +80,10 @@
}; \ }; \
\ \
HANDLER::Handle(location, stacktrace(), p_message __VA_OPT__(, ) __VA_ARGS__); \ HANDLER::Handle(location, stacktrace(), p_message __VA_OPT__(, ) __VA_ARGS__); \
if (Bigfoot::Singleton<Bigfoot::Log>::HasInstance()) \
{ \
Bigfoot::Singleton<Bigfoot::Log>::Instance().Flush(); \
} \
BREAK; \ BREAK; \
std::abort(); \ std::abort(); \
} \ } \

View File

@@ -35,6 +35,16 @@ class Singleton
return *eastl::bit_cast<TYPE*>(ms_instance.data()); return *eastl::bit_cast<TYPE*>(ms_instance.data());
} }
/**
* Is the instance initialized
*
* \return True if initialized, false otherwise
*/
static constexpr bool HasInstance()
{
return ms_initialized;
}
class Lifetime class Lifetime
{ {
public: public: