diff options
| author | Wladimir J. van der Laan <[email protected]> | 2015-10-05 13:43:53 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2015-10-06 09:59:19 +0200 |
| commit | 3b2d37c61963d423c9147d342a0985ced33ae4f1 (patch) | |
| tree | 7a25583cc4b2a37868304b57681cc29f143ff9fe /src/util.cpp | |
| parent | Merge pull request #6744 (diff) | |
| parent | Changed logging to make -logtimestamps to work also for -printtoconsole (diff) | |
| download | discoin-3b2d37c61963d423c9147d342a0985ced33ae4f1.tar.xz discoin-3b2d37c61963d423c9147d342a0985ced33ae4f1.zip | |
Merge pull request #6742
58981d4 Changed logging to make -logtimestamps to work also for -printtoconsole (Arne Brutschy)
Diffstat (limited to 'src/util.cpp')
| -rw-r--r-- | src/util.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/util.cpp b/src/util.cpp index f50d25e17..8192a7c71 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -280,10 +280,13 @@ int LogPrintStr(const std::string &str) { int ret = 0; // Returns total number of characters written static bool fStartedNewLine = true; + + string strTimestamped = LogTimestampStr(str, &fStartedNewLine); + if (fPrintToConsole) { // print to console - ret = fwrite(str.data(), 1, str.size(), stdout); + ret = fwrite(strTimestamped.data(), 1, strTimestamped.size(), stdout); fflush(stdout); } else if (fPrintToDebugLog) @@ -291,8 +294,6 @@ int LogPrintStr(const std::string &str) boost::call_once(&DebugPrintInit, debugPrintInitFlag); boost::mutex::scoped_lock scoped_lock(*mutexDebugLog); - string strTimestamped = LogTimestampStr(str, &fStartedNewLine); - // buffer if we haven't opened the log yet if (fileout == NULL) { assert(vMsgsBeforeOpenLog); |