diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-04-03 17:37:00 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-04-03 17:42:40 +0200 |
commit | 471ed00fcd3b6feb2e37ad071c7ead78b4e2dad7 (patch) | |
tree | 5a2d9c7912769e0b9e642add685fa8193b4f115f /src | |
parent | cb598cfba1cbd23b153584e2454aa49d055ba10a (diff) | |
parent | 3bde5564294b36780d1839ed4aec4612fe3a69dd (diff) |
Merge #10123: Allow debug logs to be excluded from specified component
3bde556 Add -debugexclude option to switch off logging for specified components (John Newbery)
Tree-SHA512: 30202e3f2085fc2fc5dd4bedb92988f4cb162c612a42cf8f6395a7da326f34975ddc347f82bc4ddca6c84c438dc0cc6e87869f90c7ff88105dbeaa52a947fa43
Diffstat (limited to 'src')
-rw-r--r-- | src/init.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/init.cpp b/src/init.cpp index 23a15b4fd8..59e5a4a207 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -443,6 +443,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 or if <category> = 1, output all debugging information.") + " " + _("<category> can be:") + " " + ListLogCategories() + "."); + strUsage += HelpMessageOpt("-debugexclude=<category>", strprintf(_("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 (showDebug) strUsage += HelpMessageOpt("-nodebug", "Turn off debugging messages, same as -debug=0"); strUsage += HelpMessageOpt("-help-debug", _("Show all debugging options (usage: --help -help-debug)")); @@ -914,13 +915,25 @@ bool AppInitParameterInteraction() for (const auto& cat : categories) { uint32_t flag; if (!GetLogCategory(&flag, &cat)) { - InitWarning(strprintf(_("Unsupported logging category %s.\n"), cat)); + InitWarning(strprintf(_("Unsupported logging category %s=%s."), "-debug", cat)); } 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)) { + InitWarning(strprintf(_("Unsupported logging category %s=%s."), "-debugexclude", cat)); + } + logCategories &= ~flag; + } + } + // Check for -debugnet if (GetBoolArg("-debugnet", false)) InitWarning(_("Unsupported argument -debugnet ignored, use -debug=net.")); |