Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] Add -debugexclude option #1439

Merged
merged 1 commit into from
Apr 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ std::string HelpMessage(HelpMessageMode mode)
}
strUsage += HelpMessageOpt("-debug=<category>", strprintf(_("Output debugging information (default: %u, supplying <category> is optional)"), 0) + ". " +
_("If <category> is not supplied, output all debugging information.") + _("<category> can be:") + " " + ListLogCategories() + ".");
strUsage += HelpMessageOpt("-debugexclude=<category>", _("Exclude debugging information for a category. Can be used in conjunction with -debug=1 to output debug logs for all categories except one or more specified categories."));
if (GetBoolArg("-help-debug", false))
strUsage += HelpMessageOpt("-nodebug", "Turn off debugging messages, same as -debug=0");
#ifdef ENABLE_WALLET
Expand Down Expand Up @@ -936,10 +937,22 @@ bool AppInit2()
find(categories.begin(), categories.end(), std::string("0")) != categories.end())) {
for (const auto& cat : categories) {
uint32_t flag;
if (!GetLogCategory(&flag, &cat)) {
UIWarning(strprintf(_("Unsupported logging category %s.\n"), cat));
}
logCategories |= flag;
if (!GetLogCategory(&flag, &cat))
UIWarning(strprintf(_("Unsupported logging category %s=%s."), "-debug", cat));
else
logCategories |= flag;
}
}

// Now remove the logging categories which were explicitly excluded
if (mapMultiArgs.count("-debugexclude") > 0) {
const std::vector<std::string>& excludedCategories = mapMultiArgs.at("-debugexclude");
for (const auto& cat : excludedCategories) {
uint32_t flag;
if (!GetLogCategory(&flag, &cat))
UIWarning(strprintf(_("Unsupported logging category %s=%s."), "-debugexclude", cat));
else
logCategories &= ~flag;
}
}

Expand Down