util: Refactor GetLogCategory.

Changing parameter types from pointers to references and uint32_t to
BCLog::LogFlags simplies calling code.
This commit is contained in:
Jim Posen
2018-04-11 14:06:35 -07:00
parent 3316a9ebb6
commit 1eac317f25
4 changed files with 48 additions and 38 deletions

View File

@@ -963,24 +963,18 @@ bool AppInitParameterInteraction()
if (std::none_of(categories.begin(), categories.end(),
[](std::string cat){return cat == "0" || cat == "none";})) {
for (const auto& cat : categories) {
uint32_t flag = 0;
if (!GetLogCategory(&flag, &cat)) {
if (!g_logger->EnableCategory(cat)) {
InitWarning(strprintf(_("Unsupported logging category %s=%s."), "-debug", cat));
continue;
}
g_logger->EnableCategory(static_cast<BCLog::LogFlags>(flag));
}
}
}
// Now remove the logging categories which were explicitly excluded
for (const std::string& cat : gArgs.GetArgs("-debugexclude")) {
uint32_t flag = 0;
if (!GetLogCategory(&flag, &cat)) {
if (!g_logger->DisableCategory(cat)) {
InitWarning(strprintf(_("Unsupported logging category %s=%s."), "-debugexclude", cat));
continue;
}
g_logger->DisableCategory(static_cast<BCLog::LogFlags>(flag));
}
// Check for -debugnet