From d2e4e4d8789edf275f817539c86b1a207d52b445 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Thu, 12 Nov 2026 19:22:45 +0100 Subject: [PATCH] Logger: the version line once per service name Every Logger construction printed the version line, and a rugnux run makes a logger per FFT indexer of its first-pass ladder: about 180 version lines in a 20 s live run. The line now goes out the first time a service name is seen. The set is a function-local static, as jfjoch_writer's logger is a global made before this file's own namespace-scope statics. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01HVeDQsU5a8AJUdJPgWevAK --- common/Logger.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/Logger.cpp b/common/Logger.cpp index e48564d7a..cccee71f4 100644 --- a/common/Logger.cpp +++ b/common/Logger.cpp @@ -7,6 +7,7 @@ #include "spdlog/fmt/bin_to_hex.h" #include +#include #include "Logger.h" #include "GitInfo.h" @@ -64,6 +65,15 @@ Logger::Logger(const std::string &service_name, const std::string &file_name) { spdlog_logger = std::make_shared(service_name, std::begin(sinks), std::end(sinks)); if (const auto it = service_levels.find(service_name); it != service_levels.end()) spdlog_logger->set_level(it->second); + { + // The version line goes out once per service: a run makes many loggers of one service (every FFT indexer + // is one). Function-local, as a static Logger (jfjoch_writer's) is made before this file's own statics. + static std::mutex version_mutex; + static std::set version_logged; + std::unique_lock ul(version_mutex); + if (!version_logged.insert(service_name).second) + return; + } if (jfjoch_git_sha1().empty()) spdlog_logger->info("Version {} {}", jfjoch_version(), variant); else