Log before std::abort
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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 <System/Log/Log.hpp>
|
||||
|
||||
#if defined BIGFOOT_NOT_OPTIMIZED
|
||||
|
||||
@@ -79,6 +80,10 @@
|
||||
}; \
|
||||
\
|
||||
HANDLER::Handle(location, stacktrace(), p_message __VA_OPT__(, ) __VA_ARGS__); \
|
||||
if (Bigfoot::Singleton<Bigfoot::Log>::HasInstance()) \
|
||||
{ \
|
||||
Bigfoot::Singleton<Bigfoot::Log>::Instance().Flush(); \
|
||||
} \
|
||||
BREAK; \
|
||||
std::abort(); \
|
||||
} \
|
||||
|
||||
@@ -35,6 +35,16 @@ class Singleton
|
||||
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
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user