aboutsummaryrefslogtreecommitdiff
path: root/src/init.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/init.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/init.cpp')
-rw-r--r--src/init.cpp31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 72b53ebecc..647b8d52ea 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -215,8 +215,18 @@ std::string HelpMessage(HelpMessageMode hmm)
#endif
#endif
strUsage += " -paytxfee=<amt> " + _("Fee per KB to add to transactions you send") + "\n";
- strUsage += " -debug " + _("Output extra debugging information. Implies all other -debug* options") + "\n";
- strUsage += " -debugnet " + _("Output extra network debugging information") + "\n";
+ strUsage += " -debug=<category> " + _("Output debugging information (default: 0, supplying <category> is optional)") + "\n";
+ strUsage += _("If <category> is not supplied, output all debugging information.") + "\n";
+ strUsage += _("<category> can be:");
+ strUsage += " addrman, alert, coindb, db, lock, rand, rpc, selectcoins, mempool, net"; // Don't translate these and qt below
+ if (hmm == HMM_BITCOIN_QT)
+ {
+ strUsage += ", qt.\n";
+ }
+ else
+ {
+ strUsage += ".\n";
+ }
strUsage += " -logtimestamps " + _("Prepend debug output with timestamp") + "\n";
strUsage += " -shrinkdebugfile " + _("Shrink debug.log file on client startup (default: 1 when no -debug)") + "\n";
strUsage += " -printtoconsole " + _("Send trace/debug info to console instead of debug.log file") + "\n";
@@ -457,7 +467,16 @@ bool AppInit2(boost::thread_group& threadGroup)
// ********************************************************* Step 3: parameter-to-internal-flags
- if (mapMultiArgs.count("-debug")) fDebug = true;
+ fDebug = !mapMultiArgs["-debug"].empty();
+ // Special-case: if -debug=0/-nodebug is set, turn off debugging messages
+ const vector<string>& categories = mapMultiArgs["-debug"];
+ if (GetBoolArg("-nodebug", false) || find(categories.begin(), categories.end(), string("0")) != categories.end())
+ fDebug = false;
+
+ // Check for -debugnet (deprecated)
+ if (GetBoolArg("-debugnet", false))
+ InitWarning(_("Warning: Deprecated argument -debugnet ignored, use -debug=net"));
+
fBenchmark = GetBoolArg("-benchmark", false);
mempool.fChecks = GetBoolArg("-checkmempool", RegTest());
Checkpoints::fEnabled = GetBoolArg("-checkpoints", true);
@@ -471,12 +490,6 @@ bool AppInit2(boost::thread_group& threadGroup)
else if (nScriptCheckThreads > MAX_SCRIPTCHECK_THREADS)
nScriptCheckThreads = MAX_SCRIPTCHECK_THREADS;
- // -debug implies fDebug*
- if (fDebug)
- fDebugNet = true;
- else
- fDebugNet = GetBoolArg("-debugnet", false);
-
if (fDaemon)
fServer = true;
else