| 170 | } |
| 171 | |
| 172 | std::string BCLog::Logger::LogTimestampStr(const std::string &str) |
| 173 | { |
| 174 | std::string strStamped; |
| 175 | |
| 176 | if (!m_log_timestamps) |
| 177 | return str; |
| 178 | |
| 179 | if (m_started_new_line) { |
| 180 | int64_t nTimeMicros = GetTimeMicros(); |
| 181 | strStamped = FormatISO8601DateTime(nTimeMicros/1000000); |
| 182 | if (m_log_time_micros) { |
| 183 | strStamped.pop_back(); |
| 184 | strStamped += strprintf(".%06dZ", nTimeMicros%1000000); |
| 185 | } |
| 186 | int64_t mocktime = GetMockTime(); |
| 187 | if (mocktime) { |
| 188 | strStamped += " (mocktime: " + FormatISO8601DateTime(mocktime) + ")"; |
| 189 | } |
| 190 | strStamped += ' ' + str; |
| 191 | } else |
| 192 | strStamped = str; |
| 193 | |
| 194 | if (!str.empty() && str[str.size()-1] == '\n') |
| 195 | m_started_new_line = true; |
| 196 | else |
| 197 | m_started_new_line = false; |
| 198 | |
| 199 | return strStamped; |
| 200 | } |
| 201 | |
| 202 | void BCLog::Logger::LogPrintStr(const std::string &str) |
| 203 | { |
nothing calls this directly
no test coverage detected