diff options
Diffstat (limited to 'src/util.cpp')
-rw-r--r-- | src/util.cpp | 17 |
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 |