54 lines
1.6 KiB
C++
54 lines
1.6 KiB
C++
/*********************************************************************
|
|
* \file SystemAssertHandler.hpp
|
|
*
|
|
* \author Romain BOULLARD
|
|
* \date January 2026
|
|
*********************************************************************/
|
|
#ifndef BIGFOOT_SYSTEM_SYSTEMASSERTHANDLER_HPP
|
|
#define BIGFOOT_SYSTEM_SYSTEMASSERTHANDLER_HPP
|
|
#include <System/SystemLogger_generated.hpp>
|
|
|
|
#include <Utils/Assert.hpp>
|
|
|
|
#if defined BIGFOOT_NOT_OPTIMIZED
|
|
|
|
#include <format>
|
|
#include <source_location>
|
|
|
|
namespace Bigfoot
|
|
{
|
|
class SystemAssertHandler
|
|
{
|
|
public:
|
|
SystemAssertHandler() = delete;
|
|
|
|
SystemAssertHandler(const SystemAssertHandler& p_handler) = delete;
|
|
SystemAssertHandler(SystemAssertHandler&& p_handler) = delete;
|
|
|
|
~SystemAssertHandler() = delete;
|
|
|
|
/**
|
|
* Handle an assertion.
|
|
*
|
|
* \param p_location Location of the assertion.
|
|
* \param p_format Format string for the assertion message.
|
|
* \param p_args Arguments for the format string.
|
|
*/
|
|
template<typename... ARGS>
|
|
static void Handle(const std::source_location& p_location, std::format_string<ARGS...> p_format, ARGS&&... p_args)
|
|
{
|
|
BIGFOOT_LOG_FATAL(SYSTEM_LOGGER,
|
|
"Assert: {} (File:{}, Line:{}, Function:{}\n",
|
|
std::format(p_format, std::forward<ARGS>(p_args)...),
|
|
p_location.file_name(),
|
|
p_location.line(),
|
|
p_location.function_name());
|
|
}
|
|
|
|
SystemAssertHandler& operator=(const SystemAssertHandler& p_handler) = delete;
|
|
SystemAssertHandler& operator=(SystemAssertHandler&& p_handler) = delete;
|
|
};
|
|
} // namespace Bigfoot
|
|
#endif
|
|
#endif
|