From 23880df80b59f00499143f26eaacc34105cc7194 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Wed, 17 Jan 2024 09:39:17 -0500 Subject: reinstate formatter settings for file sink (#631) fixes issue introduced in #615 --- src/zenutil/logging.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/zenutil/logging.cpp') diff --git a/src/zenutil/logging.cpp b/src/zenutil/logging.cpp index 64230ea81..eef6a59ce 100644 --- a/src/zenutil/logging.cpp +++ b/src/zenutil/logging.cpp @@ -182,6 +182,15 @@ FinishInitializeLogging(const LoggingOptions& LogOptions) spdlog::set_formatter( std::make_unique(LogOptions.LogId, std::chrono::system_clock::now())); // default to duration prefix + if (LogOptions.AbsLogFile.extension() == ".json") + { + g_FileSink->set_formatter(std::make_unique(LogOptions.LogId)); + } + else + { + g_FileSink->set_formatter(std::make_unique(LogOptions.LogId)); // this will have a date prefix + } + const std::string StartLogTime = zen::DateTime::Now().ToIso8601(); spdlog::apply_all([&](auto Logger) { Logger->info("log starting at {}", StartLogTime); }); -- cgit v1.2.3