diff --git a/src/init.cpp b/src/init.cpp --- a/src/init.cpp +++ b/src/init.cpp @@ -1384,13 +1384,13 @@ if (find(categories.begin(), categories.end(), std::string("0")) == categories.end()) { for (const auto &cat : categories) { - uint32_t flag = 0; - if (!GetLogCategory(&flag, &cat)) { + BCLog::LogFlags flag; + if (!GetLogCategory(flag, cat)) { InitWarning( strprintf(_("Unsupported logging category %s=%s."), "-debug", cat)); } - GetLogger().EnableCategory(static_cast(flag)); + GetLogger().EnableCategory(flag); } } } @@ -1398,12 +1398,12 @@ // Now remove the logging categories which were explicitly excluded if (gArgs.IsArgSet("-debugexclude")) { for (const std::string &cat : gArgs.GetArgs("-debugexclude")) { - uint32_t flag; - if (!GetLogCategory(&flag, &cat)) { + BCLog::LogFlags flag; + if (!GetLogCategory(flag, cat)) { InitWarning(strprintf(_("Unsupported logging category %s=%s."), "-debugexclude", cat)); } - GetLogger().DisableCategory(static_cast(flag)); + GetLogger().DisableCategory(flag); } } diff --git a/src/logging.h b/src/logging.h --- a/src/logging.h +++ b/src/logging.h @@ -108,8 +108,8 @@ /** Returns a string with the supported log categories */ std::string ListLogCategories(); -/** Return true if str parses as a log category and set the flags in f */ -bool GetLogCategory(uint32_t *f, const std::string *str); +/** Return true if str parses as a log category and set the flag */ +bool GetLogCategory(BCLog::LogFlags &flag, const std::string &str); #define LogPrint(category, ...) \ do { \ diff --git a/src/logging.cpp b/src/logging.cpp --- a/src/logging.cpp +++ b/src/logging.cpp @@ -51,7 +51,7 @@ } struct CLogCategoryDesc { - uint32_t flag; + BCLog::LogFlags flag; std::string category; }; @@ -82,18 +82,16 @@ {BCLog::ALL, "all"}, }; -bool GetLogCategory(uint32_t *f, const std::string *str) { - if (f && str) { - if (*str == "") { - *f = BCLog::ALL; +bool GetLogCategory(BCLog::LogFlags &flag, const std::string &str) { + if (str == "") { + flag = BCLog::ALL; + return true; + } + for (unsigned int i = 0; i < ARRAYLEN(LogCategories); i++) { + if (LogCategories[i].category == str) { + flag = LogCategories[i].flag; return true; } - for (unsigned int i = 0; i < ARRAYLEN(LogCategories); i++) { - if (LogCategories[i].category == *str) { - *f = LogCategories[i].flag; - return true; - } - } } return false; } diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -316,7 +316,7 @@ // // Debug view // - if (logCategories != BCLog::NONE) { + if (gArgs.GetBoolArg("-debug", false)) { strHTML += "

" + tr("Debug information") + "

"; for (const CTxIn &txin : wtx.tx->vin) { if (wallet->IsMine(txin))