From fa9c92d7b6394194696e014e48346a8b8562e16a Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Tue, 27 Jan 2026 13:09:08 +0100 Subject: [PATCH] log: Print warning about privacy-sensitive log info unconditionally Also, fix whitespace in this function, while touching it. Can be reviewed via the git option --ignore-all-space --- src/init/common.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/init/common.cpp b/src/init/common.cpp index c0695e52faa..cb35c1b4f62 100644 --- a/src/init/common.cpp +++ b/src/init/common.cpp @@ -78,19 +78,19 @@ util::Result SetLoggingLevel(const ArgsManager& args) util::Result SetLoggingCategories(const ArgsManager& args) { - const std::vector categories = args.GetArgs("-debug"); + const std::vector categories = args.GetArgs("-debug"); - // Special-case: Disregard any debugging categories appearing before -debug=0/none - const auto last_negated = std::find_if(categories.rbegin(), categories.rend(), - [](const std::string& cat) { return cat == "0" || cat == "none"; }); + // Special-case: Disregard any debugging categories appearing before -debug=0/none + const auto last_negated = std::find_if(categories.rbegin(), categories.rend(), + [](const std::string& cat) { return cat == "0" || cat == "none"; }); - const auto categories_to_process = (last_negated == categories.rend()) ? categories : std::ranges::subrange(last_negated.base(), categories.end()); + const auto categories_to_process = (last_negated == categories.rend()) ? categories : std::ranges::subrange(last_negated.base(), categories.end()); - for (const auto& cat : categories_to_process) { - if (!LogInstance().EnableCategory(cat)) { - return util::Error{strprintf(_("Unsupported logging category %s=%s."), "-debug", cat)}; - } + for (const auto& cat : categories_to_process) { + if (!LogInstance().EnableCategory(cat)) { + return util::Error{strprintf(_("Unsupported logging category %s=%s."), "-debug", cat)}; } + } // Now remove the logging categories which were explicitly excluded for (const std::string& cat : args.GetArgs("-debugexclude")) { @@ -99,9 +99,7 @@ util::Result SetLoggingCategories(const ArgsManager& args) } } - if (LogInstance().GetCategoryMask() != BCLog::NONE) { - LogInfo("Debug logging is enabled (-debug). Additional log output may contain privacy-sensitive information. Be cautious when sharing logs."); - } + LogInfo("Log output may contain privacy-sensitive information. Be cautious when sharing logs."); return {}; }