From e0cc2b8b1e1b1fcbadc7a0513ee1e02c80fa8cfa Mon Sep 17 00:00:00 2001 From: Nicholas Dudfield Date: Sat, 26 Jul 2025 17:02:08 +0700 Subject: [PATCH] refactor: rename LOG_HIGHLIGHT_ESCAPE to LOG_HIGHLIGHT_COLOR - More intuitive naming for users - Changed get_log_highlight_escape() to get_log_highlight_color() - Updated all references and comments - Functionality remains the same, just clearer naming --- src/ripple/basics/impl/Log.cpp | 2 +- src/ripple/beast/utility/EnhancedLogging.h | 6 +++--- src/ripple/beast/utility/src/beast_EnhancedLogging.cpp | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ripple/basics/impl/Log.cpp b/src/ripple/basics/impl/Log.cpp index 00a2025e0..afe00332e 100644 --- a/src/ripple/basics/impl/Log.cpp +++ b/src/ripple/basics/impl/Log.cpp @@ -354,7 +354,7 @@ Logs::format( if (!partition.empty()) { #ifdef BEAST_ENHANCED_LOGGING - output += beast::detail::get_log_highlight_escape(); + output += beast::detail::get_log_highlight_color(); #endif output += partition + ":"; } diff --git a/src/ripple/beast/utility/EnhancedLogging.h b/src/ripple/beast/utility/EnhancedLogging.h index 71fedf378..9a71a5cee 100644 --- a/src/ripple/beast/utility/EnhancedLogging.h +++ b/src/ripple/beast/utility/EnhancedLogging.h @@ -30,10 +30,10 @@ namespace detail { bool should_log_use_colors(); -// Get the log location escape sequence - can be overridden via -// LOG_LOCATION_ESCAPE +// Get the log highlight color - can be overridden via +// LOG_HIGHLIGHT_COLOR const char* -get_log_highlight_escape(); +get_log_highlight_color(); // Strip source root path from __FILE__ at compile time // IMPORTANT: This MUST stay in the header as constexpr for compile-time diff --git a/src/ripple/beast/utility/src/beast_EnhancedLogging.cpp b/src/ripple/beast/utility/src/beast_EnhancedLogging.cpp index f32c81d99..b2161a104 100644 --- a/src/ripple/beast/utility/src/beast_EnhancedLogging.cpp +++ b/src/ripple/beast/utility/src/beast_EnhancedLogging.cpp @@ -45,13 +45,13 @@ should_log_use_colors() return use_colors; } -// Get the log location escape sequence - can be overridden via -// LOG_LOCATION_ESCAPE +// Get the log highlight color - can be overridden via +// LOG_HIGHLIGHT_COLOR const char* -get_log_highlight_escape() +get_log_highlight_color() { static const char* escape = []() { - const char* env = std::getenv("LOG_HIGHLIGHT_ESCAPE"); + const char* env = std::getenv("LOG_HIGHLIGHT_COLOR"); if (!env) return "\033[36m"; // Default: cyan @@ -111,7 +111,7 @@ log_write_location_string(std::ostream& os, const char* file, int line) { if (detail::should_log_use_colors()) { - os << detail::get_log_highlight_escape() << "[" + os << detail::get_log_highlight_color() << "[" << detail::strip_source_root(file) << ":" << line << "]\033[0m"; } else