diff options
| author | Stefan Boberg <[email protected]> | 2023-12-12 12:13:56 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-12-12 12:13:56 +0100 |
| commit | 4e427d6cdd6a164aa0e63f7514b9ea381e639a17 (patch) | |
| tree | ec067e61ba3b684372a496267b15d2d9a0e4ea18 /src/zenutil/logging.cpp | |
| parent | 0.2.36 (diff) | |
| download | zen-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.cpp | 9 |
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(); } |