| 245 | } |
| 246 | |
| 247 | std::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 | |
| 272 | namespace BCLog { |
| 273 | /** Belts and suspenders: make sure outgoing log messages don't contain |
nothing calls this directly
no test coverage detected