mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
re-work -debug switch handling
- re-work -debug help message text - make -debug log every debugging information again (even all categories) - remove unneeded fDebug checks in front of LogPrint()/qDebug(), as that check is done in LogPrintf() when category is != NULL (true for all LogPrint() calls - remove fDebug ONLY in code which is NOT performance-critical - harmonize addrman category name - deprecate -debugnet usage, should be used via -debug=net and remove the corresponding global
This commit is contained in:
17
src/util.cpp
17
src/util.cpp
@@ -73,7 +73,6 @@ using namespace std;
|
||||
map<string, string> mapArgs;
|
||||
map<string, vector<string> > mapMultiArgs;
|
||||
bool fDebug = false;
|
||||
bool fDebugNet = false;
|
||||
bool fPrintToConsole = false;
|
||||
bool fPrintToDebugger = false;
|
||||
bool fDaemon = false;
|
||||
@@ -226,10 +225,20 @@ int LogPrint(const char* category, const char* pszFormat, ...)
|
||||
{
|
||||
if (category != NULL)
|
||||
{
|
||||
if (!fDebug) return 0;
|
||||
const vector<string>& categories = mapMultiArgs["-debug"];
|
||||
if (find(categories.begin(), categories.end(), string(category)) == categories.end())
|
||||
if (!fDebug)
|
||||
return 0;
|
||||
|
||||
const vector<string>& categories = mapMultiArgs["-debug"];
|
||||
bool allCategories = count(categories.begin(), categories.end(), string(""));
|
||||
|
||||
// Only look for categories, if not -debug/-debug=1 was passed,
|
||||
// as that implies every category should be logged.
|
||||
if (!allCategories)
|
||||
{
|
||||
// Category was not found (not supplied via -debug=<category>)
|
||||
if (find(categories.begin(), categories.end(), string(category)) == categories.end())
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int ret = 0; // Returns total number of characters written
|
||||
|
||||
Reference in New Issue
Block a user