[logging] log system time and mock time

This commit is contained in:
John Newbery
2017-05-10 15:49:00 -04:00
parent 4b766fcdd4
commit 761392db3a
3 changed files with 11 additions and 11 deletions

View File

@@ -310,10 +310,14 @@ static std::string LogTimestampStr(const std::string &str, std::atomic_bool *fSt
return str;
if (*fStartedNewLine) {
int64_t nTimeMicros = GetLogTimeMicros();
int64_t nTimeMicros = GetTimeMicros();
strStamped = DateTimeStrFormat("%Y-%m-%d %H:%M:%S", nTimeMicros/1000000);
if (fLogTimeMicros)
strStamped += strprintf(".%06d", nTimeMicros%1000000);
int64_t mocktime = GetMockTime();
if (mocktime) {
strStamped += " (mocktime: " + DateTimeStrFormat("%Y-%m-%d %H:%M:%S", mocktime) + ")";
}
strStamped += ' ' + str;
} else
strStamped = str;