| 293 | } |
| 294 | |
| 295 | std::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 | |
| 320 | namespace BCLog { |
| 321 | /** Belts and suspenders: make sure outgoing log messages don't contain |
nothing calls this directly
no test coverage detected