diff options
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(); } |