aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2025-03-10 19:38:12 +0100
committerStefan Boberg <[email protected]>2025-03-10 19:38:12 +0100
commit045ceb8def2371e852acad182279ad7984836762 (patch)
tree81c274b97c365c41beed3bbfaaeaa7cf6d0981f7 /src
parentminor: renames (diff)
downloadzen-045ceb8def2371e852acad182279ad7984836762.tar.xz
zen-045ceb8def2371e852acad182279ad7984836762.zip
Fix problem in FinishInitializeLogging when not logging to file
Diffstat (limited to 'src')
-rw-r--r--src/zenutil/logging.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/zenutil/logging.cpp b/src/zenutil/logging.cpp
index 0444fa2c4..36f4b9899 100644
--- a/src/zenutil/logging.cpp
+++ b/src/zenutil/logging.cpp
@@ -194,13 +194,16 @@ 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")
+ if (g_FileSink)
{
- 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
+ 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();