MCPcopy Create free account
hub / github.com/ElementsProject/elements / LogTimestampStr

Method LogTimestampStr

src/logging.cpp:295–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

293}
294
295std::string BCLog::Logger::LogTimestampStr(const std::string& str)
296{
297 std::string strStamped;
298
299 if (!m_log_timestamps)
300 return str;
301
302 if (m_started_new_line) {
303 int64_t nTimeMicros = GetTimeMicros();
304 strStamped = FormatISO8601DateTime(nTimeMicros/1000000);
305 if (m_log_time_micros) {
306 strStamped.pop_back();
307 strStamped += strprintf(".%06dZ", nTimeMicros%1000000);
308 }
309 std::chrono::seconds mocktime = GetMockTime();
310 if (mocktime > 0s) {
311 strStamped += " (mocktime: " + FormatISO8601DateTime(count_seconds(mocktime)) + ")";
312 }
313 strStamped += ' ' + str;
314 } else
315 strStamped = str;
316
317 return strStamped;
318}
319
320namespace BCLog {
321 /** Belts and suspenders: make sure outgoing log messages don't contain

Callers

nothing calls this directly

Calls 4

GetTimeMicrosFunction · 0.85
GetMockTimeFunction · 0.85
count_secondsFunction · 0.85
pop_backMethod · 0.45

Tested by

no test coverage detected