diff options
Diffstat (limited to 'src/zenutil/logging.cpp')
| -rw-r--r-- | src/zenutil/logging.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/zenutil/logging.cpp b/src/zenutil/logging.cpp index 3cd72eac9..4d8dcbca6 100644 --- a/src/zenutil/logging.cpp +++ b/src/zenutil/logging.cpp @@ -116,18 +116,6 @@ BeginInitializeLogging(const LoggingOptions& LogOptions) } #endif - if (FileSink) - { - if (LogOptions.AbsLogFile.extension() == ".json") - { - FileSink->set_formatter(std::make_unique<logging::json_formatter>(LogOptions.LogId)); - } - else - { - FileSink->set_pattern("[%C-%m-%d.%e %T] [%n] [%l] %v"); - } - } - spdlog::set_error_handler([](const std::string& msg) { if (msg == std::bad_alloc().what()) { @@ -182,6 +170,18 @@ FinishInitializeLogging(const LoggingOptions& LogOptions) spdlog::flush_every(std::chrono::seconds{2}); spdlog::set_formatter(std::make_unique<logging::full_formatter>(LogOptions.LogId, std::chrono::system_clock::now())); + if (g_FileSink) + { + if (LogOptions.AbsLogFile.extension() == ".json") + { + g_FileSink->set_formatter(std::make_unique<logging::json_formatter>(LogOptions.LogId)); + } + else + { + g_FileSink->set_pattern("[%C-%m-%d.%e %T] [%n] [%l] %v"); + } + } + const std::string StartLogTime = zen::DateTime::Now().ToIso8601(); spdlog::apply_all([&](auto Logger) { Logger->info("log starting at {}", StartLogTime); }); |