aboutsummaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
authorPhilip Kaufmann <phil.kaufmann@t-online.de>2013-10-08 12:09:40 +0200
committerPhilip Kaufmann <phil.kaufmann@t-online.de>2013-10-30 16:02:09 +0100
commit3b570559f8d39a5d4cffd01b8091c3133f7750dc (patch)
tree1aed798318d5b7f3677492570e8398d14e449a41 /src/util.cpp
parent42a12f22d6b644fcd879da23f6e56c310eb9985f (diff)
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
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 71994587cf..9ee1ad5f52 100644
--- a/src/util.cpp
+++ b/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