Skip to content

Commit

Permalink
Merge pull request #750 from UdjinM6/debugfixes
Browse files Browse the repository at this point in the history
Few debug related fixes
  • Loading branch information
evan82 committed Apr 5, 2016
2 parents fa0503d + 981efed commit 3ffecb7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ void InitLogging()
fLogIPs = GetBoolArg("-logips", DEFAULT_LOGIPS);

LogPrintf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
LogPrintf("Bitcoin version %s (%s)\n", FormatFullVersion(), CLIENT_DATE);
LogPrintf("Dash version %s (%s)\n", FormatFullVersion(), CLIENT_DATE);
}

/** Initialize dash.
Expand Down Expand Up @@ -1703,7 +1703,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
pwalletMain->SetBestChain(chainActive.GetLocator());
}

if(!strErrors.str().empty()) LogPrintf("%s", strErrors.str());
LogPrintf("%s", strErrors.str());
LogPrintf(" wallet %15dms\n", GetTimeMillis() - nStart);

RegisterValidationInterface(pwalletMain);
Expand Down
2 changes: 1 addition & 1 deletion src/masternodeman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ void CMasternodeMan::CheckAndRemove(bool forceExpiredRemoval)
map<uint256, CMasternodePing>::iterator it4 = mapSeenMasternodePing.begin();
while(it4 != mapSeenMasternodePing.end()){
if((*it4).second.sigTime < GetTime() - MASTERNODE_REMOVAL_SECONDS*2){
LogPrint("masternode", "CMasternodeMan::CheckAndRemove - Removing expired Masternode ping %s\n", (*it3).second.GetHash().ToString());
LogPrint("masternode", "CMasternodeMan::CheckAndRemove - Removing expired Masternode ping %s\n", (*it4).second.GetHash().ToString());
mapSeenMasternodePing.erase(it4++);
} else {
++it4;
Expand Down
2 changes: 1 addition & 1 deletion src/qt/coincontroldialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ void CoinControlDialog::updateView()
CTxIn vin = CTxIn(out.tx->GetHash(), out.i);
int rounds = pwalletMain->GetInputDarksendRounds(vin);

if(rounds >= 0) itemOutput->setText(COLUMN_DARKSEND_ROUNDS, strPad(QString::number(rounds), 11, " "));
if(rounds >= 0 || fDebug) itemOutput->setText(COLUMN_DARKSEND_ROUNDS, strPad(QString::number(rounds), 11, " "));
else itemOutput->setText(COLUMN_DARKSEND_ROUNDS, strPad(QString(tr("n/a")), 11, " "));


Expand Down
3 changes: 1 addition & 2 deletions src/sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
#ifdef DEBUG_LOCKCONTENTION
void PrintLockContention(const char* pszName, const char* pszFile, int nLine)
{
LogPrintf("LOCKCONTENTION: %s\n", pszName);
LogPrintf("Locker: %s:%d\n", pszFile, nLine);
LogPrintf("LOCKCONTENTION: %s Locker: %s:%d\n", pszName, pszFile, nLine);
}
#endif /* DEBUG_LOCKCONTENTION */

Expand Down
14 changes: 7 additions & 7 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ bool LogAcceptCategory(const char* category)
/**
* fStartedNewLine is a state variable held by the calling context that will
* suppress printing of the timestamp when multiple calls are made that don't
* end in a newline. Initialize it to true, and hold it, in the calling context.
* end in a newline. Initialize it to true, and hold/manage it, in the calling context.
*/
static std::string LogTimestampStr(const std::string &str, bool *fStartedNewLine)
{
Expand All @@ -318,18 +318,13 @@ static std::string LogTimestampStr(const std::string &str, bool *fStartedNewLine
} else
strStamped = str;

if (!str.empty() && str[str.size()-1] == '\n')
*fStartedNewLine = true;
else
*fStartedNewLine = false;

return strStamped;
}

/**
* fStartedNewLine is a state variable held by the calling context that will
* suppress printing of the thread name when multiple calls are made that don't
* end in a newline. Initialize it to true, and hold it, in the calling context.
* end in a newline. Initialize it to true, and hold/manage it, in the calling context.
*/
static std::string LogThreadNameStr(const std::string &str, bool *fStartedNewLine)
{
Expand All @@ -356,6 +351,11 @@ int LogPrintStr(const std::string &str)
std::string strThreadLogged = LogThreadNameStr(str, &fStartedNewLine);
std::string strTimestamped = LogTimestampStr(strThreadLogged, &fStartedNewLine);

if (!str.empty() && str[str.size()-1] == '\n')
fStartedNewLine = true;
else
fStartedNewLine = false;

if (fPrintToConsole)
{
// print to console
Expand Down

0 comments on commit 3ffecb7

Please sign in to comment.