Dont use logger after Shutdown (#4302)

* Only flush log if not Shutdown

* Fix null logger deref, copy it
This commit is contained in:
Niram7777 2026-04-21 22:24:05 +02:00 committed by GitHub
parent dcdbd174d2
commit 2b7d54f785
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 3 deletions

View File

@ -242,7 +242,12 @@ void Shutdown() {
}
void Flush() {
g_shad_file_sink->flush();
g_console_sink->flush();
if (g_shad_file_sink != nullptr) {
g_shad_file_sink->flush();
}
if (g_console_sink != nullptr) {
g_console_sink->flush();
}
}
} // namespace Common::Log

View File

@ -37,7 +37,11 @@ void Flush();
// Define the fmt lib macros
#define LOG_GENERIC(log_class, log_level, ...) \
SPDLOG_LOGGER_CALL(Common::Log::ALL_LOGGERS[log_class], log_level, __VA_ARGS__)
do { \
if (auto logger = Common::Log::ALL_LOGGERS[log_class]) { \
SPDLOG_LOGGER_CALL(logger, log_level, __VA_ARGS__); \
} \
} while (false)
#ifdef _DEBUG
#define LOG_TRACE(log_class, ...) \