Skip to content

Commit 9e9056c

Browse files
committed
Remove -logtodebugger
`-logtodebugger` is a strange, obscure, WIN32-only (mostly MSVC) thing. Let's clean up the options a bit get rid of it. test_bitcoin was using fLogToDebugger as a way to prevent logging to debug.log. For this, add a boolean (not exposed as option) fLogToDebugLog that defaults to true and is disabled in the tests.
1 parent 8a7606f commit 9e9056c

File tree

4 files changed

+4
-32
lines changed

4 files changed

+4
-32
lines changed

src/init.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,6 @@ std::string HelpMessage(HelpMessageMode hmm)
245245
strUsage += " -printtoconsole " + _("Send trace/debug info to console instead of debug.log file") + "\n";
246246
strUsage += " -regtest " + _("Enter regression test mode, which uses a special chain in which blocks can be "
247247
"solved instantly. This is intended for regression testing tools and app development.") + "\n";
248-
#ifdef WIN32
249-
strUsage += " -printtodebugger " + _("Send trace/debug info to debugger") + "\n";
250-
#endif
251-
252248
if (hmm == HMM_BITCOIN_QT)
253249
{
254250
strUsage += " -server " + _("Accept command line and JSON-RPC commands") + "\n";
@@ -492,7 +488,6 @@ bool AppInit2(boost::thread_group& threadGroup, bool fForceServer)
492488
fServer = GetBoolArg("-server", false);
493489

494490
fPrintToConsole = GetBoolArg("-printtoconsole", false);
495-
fPrintToDebugger = GetBoolArg("-printtodebugger", false);
496491
fLogTimestamps = GetBoolArg("-logtimestamps", true);
497492
#ifdef ENABLE_WALLET
498493
bool fDisableWallet = GetBoolArg("-disablewallet", false);

src/test/test_bitcoin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ struct TestingSetup {
2626
boost::thread_group threadGroup;
2727

2828
TestingSetup() {
29-
fPrintToDebugger = true; // don't want to write to debug.log file
29+
fPrintToDebugLog = false; // don't want to write to debug.log file
3030
noui_connect();
3131
#ifdef ENABLE_WALLET
3232
bitdb.MakeMock();

src/util.cpp

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ map<string, string> mapArgs;
8888
map<string, vector<string> > mapMultiArgs;
8989
bool fDebug = false;
9090
bool fPrintToConsole = false;
91-
bool fPrintToDebugger = false;
91+
bool fPrintToDebugLog = true;
9292
bool fDaemon = false;
9393
bool fServer = false;
9494
string strMiscWarning;
@@ -270,7 +270,7 @@ int LogPrint(const char* category, const char* pszFormat, ...)
270270
ret += vprintf(pszFormat, arg_ptr);
271271
va_end(arg_ptr);
272272
}
273-
else if (!fPrintToDebugger)
273+
else if (fPrintToDebugLog)
274274
{
275275
static bool fStartedNewLine = true;
276276
boost::call_once(&DebugPrintInit, debugPrintInitFlag);
@@ -302,29 +302,6 @@ int LogPrint(const char* category, const char* pszFormat, ...)
302302
va_end(arg_ptr);
303303
}
304304

305-
#ifdef WIN32
306-
if (fPrintToDebugger)
307-
{
308-
// accumulate and output a line at a time
309-
static std::string buffer;
310-
311-
boost::mutex::scoped_lock scoped_lock(*mutexDebugLog);
312-
313-
va_list arg_ptr;
314-
va_start(arg_ptr, pszFormat);
315-
buffer += vstrprintf(pszFormat, arg_ptr);
316-
va_end(arg_ptr);
317-
318-
int line_start = 0, line_end;
319-
while((line_end = buffer.find('\n', line_start)) != -1)
320-
{
321-
OutputDebugStringA(buffer.substr(line_start, line_end - line_start).c_str());
322-
line_start = line_end + 1;
323-
ret += line_end-line_start;
324-
}
325-
buffer.erase(0, line_start);
326-
}
327-
#endif
328305
return ret;
329306
}
330307

src/util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ extern std::map<std::string, std::string> mapArgs;
120120
extern std::map<std::string, std::vector<std::string> > mapMultiArgs;
121121
extern bool fDebug;
122122
extern bool fPrintToConsole;
123-
extern bool fPrintToDebugger;
123+
extern bool fPrintToDebugLog;
124124
extern bool fDaemon;
125125
extern bool fServer;
126126
extern std::string strMiscWarning;

0 commit comments

Comments
 (0)