[*] Move #if defined(_AUHAS_FMT) around

This commit is contained in:
Reece Wilson 2024-03-17 06:13:10 +00:00
parent 0edf00ffc8
commit 1fc131e10a
2 changed files with 36 additions and 19 deletions

View File

@ -19,11 +19,11 @@ static inline void AU_NORETURN SysPanic(fmt::format_string<T...> msg, T&& ... ar
if (Aurora::RuntimeHasStarted()) if (Aurora::RuntimeHasStarted())
{ {
Aurora::Debug::AddMemoryCrunch(); Aurora::Debug::AddMemoryCrunch();
try AUROXTL_COMMODITY_TRY
{ {
Aurora::Logging::WriteLinef(static_cast<AuUInt8>(Aurora::Logging::ELogLevel::eError), Aurora::Console::EAnsiColor::eBoldRed, "Fatal", msg, AuForward<T>(args)...); Aurora::Logging::WriteLinef(static_cast<AuUInt8>(Aurora::Logging::ELogLevel::eError), Aurora::Console::EAnsiColor::eBoldRed, "Fatal", msg, AuForward<T>(args)...);
} }
catch (...) AUROXTL_COMMODITY_CATCH
{ {
} }
@ -38,11 +38,11 @@ static inline void AU_NORETURN SysPanic2(AuUInt uLineHintInNonshipBinary,
if (Aurora::RuntimeHasStarted()) if (Aurora::RuntimeHasStarted())
{ {
Aurora::Debug::AddMemoryCrunch(); Aurora::Debug::AddMemoryCrunch();
try AUROXTL_COMMODITY_TRY
{ {
Aurora::Logging::WriteLinef(static_cast<AuUInt8>(Aurora::Logging::ELogLevel::eError), Aurora::Console::EAnsiColor::eBoldRed, "Fatal", msg, AuForward<T>(args)...); Aurora::Logging::WriteLinef(static_cast<AuUInt8>(Aurora::Logging::ELogLevel::eError), Aurora::Console::EAnsiColor::eBoldRed, "Fatal", msg, AuForward<T>(args)...);
} }
catch (...) AUROXTL_COMMODITY_CATCH
{ {
} }
@ -50,28 +50,32 @@ static inline void AU_NORETURN SysPanic2(AuUInt uLineHintInNonshipBinary,
Aurora::Debug::Panic2(uLineHintInNonshipBinary); Aurora::Debug::Panic2(uLineHintInNonshipBinary);
} }
template<typename ... T>
static inline void AU_NORETURN SysPanic()
{
Aurora::Debug::Panic();
}
template<typename ... T>
static inline void AU_NORETURN SysPanic2(AuUInt uLineHintInNonshipBinary)
{
Aurora::Debug::Panic2(uLineHintInNonshipBinary);
}
static inline AU_NORETURN void SysPanic(const char *pMsg) static inline AU_NORETURN void SysPanic(const char *pMsg)
{ {
SysPanic("{}", pMsg); SysPanic("{}", pMsg);
} }
#endif
#if defined(_AUHAS_FMT)
template<typename ... T>
#endif
static inline void AU_NORETURN SysPanic()
{
Aurora::Debug::Panic();
}
#if defined(_AUHAS_FMT)
template<typename ... T>
#endif
static inline void AU_NORETURN SysPanic2(AuUInt uLineHintInNonshipBinary)
{
Aurora::Debug::Panic2(uLineHintInNonshipBinary);
}
static inline AU_NORETURN void SysUnreachable_(int uLineHintInNonshipBinary) static inline AU_NORETURN void SysUnreachable_(int uLineHintInNonshipBinary)
{ {
Aurora::Debug::Panic2(uLineHintInNonshipBinary); Aurora::Debug::Panic2(uLineHintInNonshipBinary);
} }
#define SysUnreachable() SysUnreachable_(SysSafeLine) #define SysUnreachable() SysUnreachable_(SysSafeLine)
#endif

View File

@ -182,6 +182,8 @@ namespace Aurora::Logging
#endif #endif
} }
#if defined(_AUHAS_FMT)
#define ADD_AU_GLOBAL_ALIAS(level)\ #define ADD_AU_GLOBAL_ALIAS(level)\
template<typename ... T> \ template<typename ... T> \
static void AuLog ## level(fmt::format_string<T...> line, T&& ... args) \ static void AuLog ## level(fmt::format_string<T...> line, T&& ... args) \
@ -189,6 +191,17 @@ namespace Aurora::Logging
Aurora::Logging::Log ## level(line, AuForward<T>(args)...); \ Aurora::Logging::Log ## level(line, AuForward<T>(args)...); \
} }
#else
#define ADD_AU_GLOBAL_ALIAS(level)\
template<typename ... T> \
static void AuLog ## level(const AuString &line, T&& ... args) \
{ \
Aurora::Logging::Log ## level(line); \
}
#endif
ADD_AU_GLOBAL_ALIAS(Info) ADD_AU_GLOBAL_ALIAS(Info)
ADD_AU_GLOBAL_ALIAS(Dbg) ADD_AU_GLOBAL_ALIAS(Dbg)
ADD_AU_GLOBAL_ALIAS(Warn) ADD_AU_GLOBAL_ALIAS(Warn)