mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
Replace printf with LogPrintf / LogPrint
This commit is contained in:
26
src/util.cpp
26
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)
|
||||
|
||||
Reference in New Issue
Block a user