assert/logging: Stop the logging thread and flush the backends before crashing (#7146)

This commit is contained in:
SachinVin
2023-11-12 01:25:42 +05:30
committed by GitHub
parent 222b1cc0d7
commit ceeda05798
3 changed files with 25 additions and 0 deletions

View File

@ -6,6 +6,7 @@
#include <cstdlib>
#include "common/common_funcs.h"
#include "common/logging/backend.h"
#include "common/logging/log.h"
// For asserts we'd like to keep all the junk executed when an assert happens away from the
@ -17,6 +18,7 @@
if (!(_a_)) [[unlikely]] { \
[]() CITRA_NO_INLINE CITRA_NO_RETURN { \
LOG_CRITICAL(Debug, "Assertion Failed!"); \
Common::Log::Stop(); \
Crash(); \
exit(1); \
}(); \
@ -28,6 +30,7 @@
if (!(_a_)) [[unlikely]] { \
[&]() CITRA_NO_INLINE CITRA_NO_RETURN { \
LOG_CRITICAL(Debug, "Assertion Failed!\n" __VA_ARGS__); \
Common::Log::Stop(); \
Crash(); \
exit(1); \
}(); \
@ -37,6 +40,7 @@
#define UNREACHABLE() \
([]() CITRA_NO_INLINE CITRA_NO_RETURN { \
LOG_CRITICAL(Debug, "Unreachable code!"); \
Common::Log::Stop(); \
Crash(); \
exit(1); \
}())
@ -44,6 +48,7 @@
#define UNREACHABLE_MSG(...) \
([&]() CITRA_NO_INLINE CITRA_NO_RETURN { \
LOG_CRITICAL(Debug, "Unreachable code!\n" __VA_ARGS__); \
Common::Log::Stop(); \
Crash(); \
exit(1); \
}())