aboutsummaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2013-09-18 20:38:08 +1000
committerGavin Andresen <gavinandresen@gmail.com>2013-09-18 20:39:25 +1000
commit881a85a22d76c875f519cd54388a419ec6f70857 (patch)
tree3f71daa59ac35c5dda44747c0b62dbc8602d8f1c /src/util.cpp
parente51321fb75f00194425e5ecc8ad77fd6762ec221 (diff)
Replace printf with LogPrintf / LogPrint
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 466f6ddff6..281ced2fa9 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -166,7 +166,7 @@ void RandAddSeedPerfmon()
{
RAND_add(pdata, nSize, nSize/100.0);
OPENSSL_cleanse(pdata, nSize);
- printf("RandAddSeed() %lu bytes\n", nSize);
+ LogPrint("rand", "RandAddSeed() %lu bytes\n", nSize);
}
#endif
}
@@ -368,7 +368,7 @@ bool error(const char *format, ...)
va_start(arg_ptr, format);
std::string str = vstrprintf(format, arg_ptr);
va_end(arg_ptr);
- printf("ERROR: %s\n", str.c_str());
+ LogPrintf("ERROR: %s\n", str.c_str());
return false;
}
@@ -1002,13 +1002,13 @@ static std::string FormatException(std::exception* pex, const char* pszThread)
void LogException(std::exception* pex, const char* pszThread)
{
std::string message = FormatException(pex, pszThread);
- printf("\n%s", message.c_str());
+ LogPrintf("\n%s", message.c_str());
}
void PrintException(std::exception* pex, const char* pszThread)
{
std::string message = FormatException(pex, pszThread);
- printf("\n\n************************\n%s\n", message.c_str());
+ LogPrintf("\n\n************************\n%s\n", message.c_str());
fprintf(stderr, "\n\n************************\n%s\n", message.c_str());
strMiscWarning = message;
throw;
@@ -1017,7 +1017,7 @@ void PrintException(std::exception* pex, const char* pszThread)
void PrintExceptionContinue(std::exception* pex, const char* pszThread)
{
std::string message = FormatException(pex, pszThread);
- printf("\n\n************************\n%s\n", message.c_str());
+ LogPrintf("\n\n************************\n%s\n", message.c_str());
fprintf(stderr, "\n\n************************\n%s\n", message.c_str());
strMiscWarning = message;
}
@@ -1330,7 +1330,7 @@ void AddTimeData(const CNetAddr& ip, int64 nTime)
// Add data
vTimeOffsets.input(nOffsetSample);
- printf("Added time data, samples %d, offset %+"PRI64d" (%+"PRI64d" minutes)\n", vTimeOffsets.size(), nOffsetSample, nOffsetSample/60);
+ LogPrintf("Added time data, samples %d, offset %+"PRI64d" (%+"PRI64d" minutes)\n", vTimeOffsets.size(), nOffsetSample, nOffsetSample/60);
if (vTimeOffsets.size() >= 5 && vTimeOffsets.size() % 2 == 1)
{
int64 nMedian = vTimeOffsets.median();
@@ -1358,17 +1358,17 @@ void AddTimeData(const CNetAddr& ip, int64 nTime)
fDone = true;
string strMessage = _("Warning: Please check that your computer's date and time are correct! If your clock is wrong Bitcoin will not work properly.");
strMiscWarning = strMessage;
- printf("*** %s\n", strMessage.c_str());
+ LogPrintf("*** %s\n", strMessage.c_str());
uiInterface.ThreadSafeMessageBox(strMessage, "", CClientUIInterface::MSG_WARNING);
}
}
}
if (fDebug) {
BOOST_FOREACH(int64 n, vSorted)
- printf("%+"PRI64d" ", n);
- printf("| ");
+ LogPrintf("%+"PRI64d" ", n);
+ LogPrintf("| ");
}
- printf("nTimeOffset = %+"PRI64d" (%+"PRI64d" minutes)\n", nTimeOffset, nTimeOffset/60);
+ LogPrintf("nTimeOffset = %+"PRI64d" (%+"PRI64d" minutes)\n", nTimeOffset, nTimeOffset/60);
}
}
@@ -1430,7 +1430,7 @@ boost::filesystem::path GetSpecialFolderPath(int nFolder, bool fCreate)
return fs::path(pszPath);
}
- printf("SHGetSpecialFolderPathA() failed, could not obtain requested path.\n");
+ LogPrintf("SHGetSpecialFolderPathA() failed, could not obtain requested path.\n");
return fs::path("");
}
#endif
@@ -1450,7 +1450,7 @@ boost::filesystem::path GetTempPath() {
path = boost::filesystem::path("/tmp");
#endif
if (path.empty() || !boost::filesystem::is_directory(path)) {
- printf("GetTempPath(): failed to find temp path\n");
+ LogPrintf("GetTempPath(): failed to find temp path\n");
return boost::filesystem::path("");
}
return path;
@@ -1461,7 +1461,7 @@ void runCommand(std::string strCommand)
{
int nErr = ::system(strCommand.c_str());
if (nErr)
- printf("runCommand error: system(%s) returned %d\n", strCommand.c_str(), nErr);
+ LogPrintf("runCommand error: system(%s) returned %d\n", strCommand.c_str(), nErr);
}
void RenameThread(const char* name)