mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
Add option for microsecond precision in debug.log
This commit is contained in:
parent
d78a880900
commit
7bbc7c314f
5 changed files with 22 additions and 3 deletions
11
src/util.cpp
11
src/util.cpp
|
|
@ -108,6 +108,7 @@ bool fDaemon = false;
|
|||
bool fServer = false;
|
||||
string strMiscWarning;
|
||||
bool fLogTimestamps = false;
|
||||
bool fLogTimeMicros = DEFAULT_LOGTIMEMICROS;
|
||||
bool fLogIPs = false;
|
||||
volatile bool fReopenDebugLog = false;
|
||||
CTranslationInterface translationInterface;
|
||||
|
|
@ -263,9 +264,13 @@ static std::string LogTimestampStr(const std::string &str, bool *fStartedNewLine
|
|||
if (!fLogTimestamps)
|
||||
return str;
|
||||
|
||||
if (*fStartedNewLine)
|
||||
strStamped = DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime()) + ' ' + str;
|
||||
else
|
||||
if (*fStartedNewLine) {
|
||||
int64_t nTimeMicros = GetLogTimeMicros();
|
||||
strStamped = DateTimeStrFormat("%Y-%m-%d %H:%M:%S", nTimeMicros/1000000);
|
||||
if (fLogTimeMicros)
|
||||
strStamped += strprintf(".%06d", nTimeMicros%1000000);
|
||||
strStamped += ' ' + str;
|
||||
} else
|
||||
strStamped = str;
|
||||
|
||||
if (!str.empty() && str[str.size()-1] == '\n')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue