aboutsummaryrefslogtreecommitdiff
path: root/src/zenutil/logging.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-12-13 08:09:09 -0500
committerGitHub <[email protected]>2023-12-13 14:09:09 +0100
commit759a80565c11a329db003b18001b7916eca8b4a5 (patch)
tree1797a128ca92357da18cd04772902a3910e34227 /src/zenutil/logging.cpp
parentchangelog (diff)
downloadzen-759a80565c11a329db003b18001b7916eca8b4a5.tar.xz
zen-759a80565c11a329db003b18001b7916eca8b4a5.zip
fix crash at log exit (#605)
* keep g_FileSink alive until spdlog has shut down
Diffstat (limited to 'src/zenutil/logging.cpp')
-rw-r--r--src/zenutil/logging.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/zenutil/logging.cpp b/src/zenutil/logging.cpp
index 2c1feb08a..5679fada2 100644
--- a/src/zenutil/logging.cpp
+++ b/src/zenutil/logging.cpp
@@ -196,17 +196,15 @@ FinishInitializeLogging(const LoggingOptions& LogOptions)
void
ShutdownLogging()
{
- g_FileSink.reset();
-
- if (!g_IsLoggingInitialized)
+ if (g_IsLoggingInitialized)
{
- return;
+ auto DefaultLogger = zen::logging::Default();
+ ZEN_LOG_INFO(DefaultLogger, "log ending at {}", zen::DateTime::Now().ToIso8601());
}
- auto DefaultLogger = zen::logging::Default();
- ZEN_LOG_INFO(DefaultLogger, "log ending at {}", zen::DateTime::Now().ToIso8601());
-
zen::logging::ShutdownLogging();
+
+ g_FileSink.reset();
}
} // namespace zen