Skip to content

Commit 3b2d37c

Browse files
committed
Merge pull request #6742
58981d4 Changed logging to make -logtimestamps to work also for -printtoconsole (Arne Brutschy)
2 parents a75c673 + 58981d4 commit 3b2d37c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/util.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,19 +280,20 @@ int LogPrintStr(const std::string &str)
280280
{
281281
int ret = 0; // Returns total number of characters written
282282
static bool fStartedNewLine = true;
283+
284+
string strTimestamped = LogTimestampStr(str, &fStartedNewLine);
285+
283286
if (fPrintToConsole)
284287
{
285288
// print to console
286-
ret = fwrite(str.data(), 1, str.size(), stdout);
289+
ret = fwrite(strTimestamped.data(), 1, strTimestamped.size(), stdout);
287290
fflush(stdout);
288291
}
289292
else if (fPrintToDebugLog)
290293
{
291294
boost::call_once(&DebugPrintInit, debugPrintInitFlag);
292295
boost::mutex::scoped_lock scoped_lock(*mutexDebugLog);
293296

294-
string strTimestamped = LogTimestampStr(str, &fStartedNewLine);
295-
296297
// buffer if we haven't opened the log yet
297298
if (fileout == NULL) {
298299
assert(vMsgsBeforeOpenLog);

0 commit comments

Comments
 (0)