aboutsummaryrefslogtreecommitdiff
path: root/src/zenutil/logging.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2023-12-12 12:13:56 +0100
committerGitHub <[email protected]>2023-12-12 12:13:56 +0100
commit4e427d6cdd6a164aa0e63f7514b9ea381e639a17 (patch)
treeec067e61ba3b684372a496267b15d2d9a0e4ea18 /src/zenutil/logging.cpp
parent0.2.36 (diff)
downloadzen-4e427d6cdd6a164aa0e63f7514b9ea381e639a17.tar.xz
zen-4e427d6cdd6a164aa0e63f7514b9ea381e639a17.zip
premature logging shutdown fix (#603)v0.2.36
Diffstat (limited to 'src/zenutil/logging.cpp')
-rw-r--r--src/zenutil/logging.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/zenutil/logging.cpp b/src/zenutil/logging.cpp
index fedfdc7e8..2c1feb08a 100644
--- a/src/zenutil/logging.cpp
+++ b/src/zenutil/logging.cpp
@@ -23,6 +23,7 @@ ZEN_THIRD_PARTY_INCLUDES_END
namespace zen {
+static bool g_IsLoggingInitialized;
spdlog::sink_ptr g_FileSink;
spdlog::sink_ptr
@@ -188,6 +189,8 @@ FinishInitializeLogging(const LoggingOptions& LogOptions)
const std::string StartLogTime = zen::DateTime::Now().ToIso8601();
spdlog::apply_all([&](auto Logger) { Logger->info("log starting at {}", StartLogTime); });
+
+ g_IsLoggingInitialized = true;
}
void
@@ -195,8 +198,14 @@ ShutdownLogging()
{
g_FileSink.reset();
+ if (!g_IsLoggingInitialized)
+ {
+ return;
+ }
+
auto DefaultLogger = zen::logging::Default();
ZEN_LOG_INFO(DefaultLogger, "log ending at {}", zen::DateTime::Now().ToIso8601());
+
zen::logging::ShutdownLogging();
}