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
This commit is contained in:
1 file changed
+10
-12
+10
-12
@@ -78,19 +78,19 @@ util::Result<void> SetLoggingLevel(const ArgsManager& args)
|
|||||||
|
|
||||||
util::Result<void> SetLoggingCategories(const ArgsManager& args)
|
util::Result<void> SetLoggingCategories(const ArgsManager& args)
|
||||||
{
|
{
|
||||||
const std::vector<std::string> categories = args.GetArgs("-debug");
|
const std::vector<std::string> categories = args.GetArgs("-debug");
|
||||||
|
|
||||||
// Special-case: Disregard any debugging categories appearing before -debug=0/none
|
// Special-case: Disregard any debugging categories appearing before -debug=0/none
|
||||||
const auto last_negated = std::find_if(categories.rbegin(), categories.rend(),
|
const auto last_negated = std::find_if(categories.rbegin(), categories.rend(),
|
||||||
[](const std::string& cat) { return cat == "0" || cat == "none"; });
|
[](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) {
|
for (const auto& cat : categories_to_process) {
|
||||||
if (!LogInstance().EnableCategory(cat)) {
|
if (!LogInstance().EnableCategory(cat)) {
|
||||||
return util::Error{strprintf(_("Unsupported logging category %s=%s."), "-debug", cat)};
|
return util::Error{strprintf(_("Unsupported logging category %s=%s."), "-debug", cat)};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Now remove the logging categories which were explicitly excluded
|
// Now remove the logging categories which were explicitly excluded
|
||||||
for (const std::string& cat : args.GetArgs("-debugexclude")) {
|
for (const std::string& cat : args.GetArgs("-debugexclude")) {
|
||||||
@@ -99,9 +99,7 @@ util::Result<void> SetLoggingCategories(const ArgsManager& args)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LogInstance().GetCategoryMask() != BCLog::NONE) {
|
LogInfo("Log output may contain privacy-sensitive information. Be cautious when sharing logs.");
|
||||||
LogInfo("Debug logging is enabled (-debug). Additional log output may contain privacy-sensitive information. Be cautious when sharing logs.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user