From 3b570559f8d39a5d4cffd01b8091c3133f7750dc Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Tue, 8 Oct 2013 12:09:40 +0200 Subject: 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 --- src/init.cpp | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'src/init.cpp') diff --git a/src/init.cpp b/src/init.cpp index 72b53ebec..647b8d52e 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -215,8 +215,18 @@ std::string HelpMessage(HelpMessageMode hmm) #endif #endif strUsage += " -paytxfee= " + _("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= " + _("Output debugging information (default: 0, supplying is optional)") + "\n"; + strUsage += _("If is not supplied, output all debugging information.") + "\n"; + strUsage += _(" 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& 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 -- cgit v1.2.3