From 9d6a0358d08171a9ec03baa907ad71fc288ab249 Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Sun, 18 May 2025 00:25:41 -0500 Subject: [PATCH] Flush logs every 3 seconds or on logging info or higher --- wxdata/source/scwx/util/logger.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wxdata/source/scwx/util/logger.cpp b/wxdata/source/scwx/util/logger.cpp index 8a97d80e..407ce354 100644 --- a/wxdata/source/scwx/util/logger.cpp +++ b/wxdata/source/scwx/util/logger.cpp @@ -20,6 +20,12 @@ static std::vector> extraSinks_ {}; void Initialize() { spdlog::set_pattern(logPattern_); + + // Periodically flush every 3 seconds + spdlog::flush_every(std::chrono::seconds(3)); + + // Flush whenever logging info or higher + spdlog::flush_on(spdlog::level::level_enum::info); } void AddFileSink(const std::string& baseFilename)