diff options
| author | Stefan Boberg <[email protected]> | 2024-01-17 09:39:17 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-01-17 09:39:17 -0500 |
| commit | 23880df80b59f00499143f26eaacc34105cc7194 (patch) | |
| tree | f33a28005fb8fc5be17cf8acf7fc772713b92780 /src/zenutil/logging.cpp | |
| parent | remove use of <random> in stats (#628) (diff) | |
| download | zen-23880df80b59f00499143f26eaacc34105cc7194.tar.xz zen-23880df80b59f00499143f26eaacc34105cc7194.zip | |
reinstate formatter settings for file sink (#631)
fixes issue introduced in #615
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 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<logging::full_formatter>(LogOptions.LogId, std::chrono::system_clock::now())); // default to duration prefix + if (LogOptions.AbsLogFile.extension() == ".json") + { + g_FileSink->set_formatter(std::make_unique<logging::json_formatter>(LogOptions.LogId)); + } + else + { + g_FileSink->set_formatter(std::make_unique<logging::full_formatter>(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); }); |