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

Method LogTimestampStr

src/logging.cpp:172–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172std::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
202void BCLog::Logger::LogPrintStr(const std::string &str)
203{

Callers

nothing calls this directly

Calls 6

GetTimeMicrosFunction · 0.85
FormatISO8601DateTimeFunction · 0.85
GetMockTimeFunction · 0.85
pop_backMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected