added functions to rpc logging

This commit is contained in:
instagibbs 2016-06-06 11:04:53 -04:00 committed by Gregory Sanders
parent a358337b92
commit ea90488a5e
5 changed files with 68 additions and 15 deletions

View file

@ -119,7 +119,7 @@ bool fLogTimestamps = DEFAULT_LOGTIMESTAMPS;
bool fLogTimeMicros = DEFAULT_LOGTIMEMICROS;
bool fLogIPs = DEFAULT_LOGIPS;
std::atomic<bool> fReopenDebugLog(false);
volatile bool fReopenAuditLog = false;
std::atomic<bool> fReopenAuditLog(false);
CTranslationInterface translationInterface;
/** Init OpenSSL library multithreading support */
@ -232,12 +232,11 @@ void OpenDebugLog()
boost::filesystem::path pathDebug = GetDataDir() / "debug.log";
fileout_debug = fopen(pathDebug.string().c_str(), "a");
if (fileout_debug) setbuf(fileout_debug, NULL); // unbuffered
setbuf(fileout, NULL); // unbuffered
setbuf(fileout_debug, NULL); // unbuffered
// dump buffered messages from before we opened the log
while (!vMsgsBeforeOpenDebugLog->empty()) {
FileWriteStr(vMsgsBeforeOpenDebugLog->front(), fileout_debug);
vMsgsBeforeOpenDebugLog->pop_front();
}
}
delete vMsgsBeforeOpenDebugLog;
@ -370,7 +369,7 @@ int DebugLogPrintStr(const std::string &str)
int AuditLogPrintStr(const std::string &str)
{
int ret = 0; // Returns total number of characters written
static bool fStartedNewLine = true;
static std::atomic_bool fStartedNewLine(true);
string strTimestamped = LogTimestampStr(str, &fStartedNewLine);
@ -929,4 +928,4 @@ std::string CopyrightHolders(const std::string& strPrefix)
strCopyrightHolders += "\n" + strPrefix + "The Bitcoin Core developers";
}
return strCopyrightHolders;
}
}