MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / LogTimestampStr

Method LogTimestampStr

src/logging.cpp:247–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245}
246
247std::string BCLog::Logger::LogTimestampStr(const std::string& str)
248{
249 std::string strStamped;
250
251 if (!m_log_timestamps)
252 return str;
253
254 if (m_started_new_line) {
255 int64_t nTimeMicros = GetTimeMicros();
256 strStamped = FormatISO8601DateTime(nTimeMicros/1000000);
257 if (m_log_time_micros) {
258 strStamped.pop_back();
259 strStamped += strprintf(".%06dZ", nTimeMicros%1000000);
260 }
261 int64_t mocktime = GetMockTime();
262 if (mocktime) {
263 strStamped += " (mocktime: " + FormatISO8601DateTime(mocktime) + ")";
264 }
265 strStamped += ' ' + str;
266 } else
267 strStamped = str;
268
269 return strStamped;
270}
271
272namespace BCLog {
273 /** Belts and suspenders: make sure outgoing log messages don't contain

Callers

nothing calls this directly

Calls 4

FormatISO8601DateTimeFunction · 0.85
GetMockTimeFunction · 0.85
pop_backMethod · 0.80
GetTimeMicrosFunction · 0.50

Tested by

no test coverage detected