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

Function LogTimestampStr

src/util.cpp:259–277  ·  view source on GitHub ↗

* fStartedNewLine is a state variable held by the calling context that will * suppress printing of the timestamp when multiple calls are made that don't * end in a newline. Initialize it to true, and hold it, in the calling context. */

Source from the content-addressed store, hash-verified

257 * end in a newline. Initialize it to true, and hold it, in the calling context.
258 */
259static std::string LogTimestampStr(const std::string &str, bool *fStartedNewLine)
260{
261 string strStamped;
262
263 if (!fLogTimestamps)
264 return str;
265
266 if (*fStartedNewLine)
267 strStamped = DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime()) + ' ' + str;
268 else
269 strStamped = str;
270
271 if (!str.empty() && str[str.size()-1] == '\n')
272 *fStartedNewLine = true;
273 else
274 *fStartedNewLine = false;
275
276 return strStamped;
277}
278
279int LogPrintStr(const std::string &str)
280{

Callers 1

LogPrintStrFunction · 0.85

Calls 4

DateTimeStrFormatFunction · 0.85
GetTimeFunction · 0.85
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected