From ed15220901b843a11318b981e8f1c830d6c95fa6 Mon Sep 17 00:00:00 2001 From: JCW Date: Fri, 1 May 2026 13:21:10 +0100 Subject: [PATCH] fix clang-tidy errors --- include/xrpl/basics/Logger.h | 6 +++--- include/xrpl/basics/StructuredLogging.h | 10 +++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/xrpl/basics/Logger.h b/include/xrpl/basics/Logger.h index 52f6f96f1e..58c9e09563 100644 --- a/include/xrpl/basics/Logger.h +++ b/include/xrpl/basics/Logger.h @@ -94,9 +94,9 @@ defaultJsonLogFormat() struct LoggingConfiguration { bool enableConsole{}; - std::optional directory; + std::optional directory{std::nullopt}; bool isAsync{}; - Severity defaultSeverity; + Severity defaultSeverity{Severity::DBG}; bool jsonMode{false}; }; @@ -223,7 +223,7 @@ class Logger if (jsonMode_) { - detail::appendJsonField(messageParams_, p.name(), p.value()); + detail::appendJsonField(messageParams_, p.name(), std::move(p).value()); } return *this; diff --git a/include/xrpl/basics/StructuredLogging.h b/include/xrpl/basics/StructuredLogging.h index 6697100b80..b0717cfa3c 100644 --- a/include/xrpl/basics/StructuredLogging.h +++ b/include/xrpl/basics/StructuredLogging.h @@ -179,10 +179,17 @@ public: /** @brief Get the parameter value. */ [[nodiscard]] T const& - value() const + value() const& { return value_; } + + /** @brief Get the parameter value. */ + [[nodiscard]] T&& + value() && + { + return std::move(value_); + } }; /** @@ -231,6 +238,7 @@ template [[nodiscard]] std::string buildJsonPattern(std::string_view existingPattern, log::Parameter const&... params) { + // NOLINTNEXTLINE(misc-const-correctness) detail::JsonLoggingPatternBuilder builder(existingPattern); (builder.add(params.name(), params.value()), ...); return builder.build();