MCPcopy Create free account
hub / github.com/apache/trafficserver / generate_format_string

Method generate_format_string

src/tsutil/DbgCtl.cc:386–415  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

384} // namespace
385
386size_t
387DebugInterface::generate_format_string(swoc::LocalBufferWriter<1024> &format_writer, const char *debug_tag, DiagsLevel diags_level,
388 const SourceLocation *loc, DiagsShowLocation show_location, const char *format_string)
389{
390 // Save room for optional newline and terminating NUL bytes.
391 format_writer.restrict(2);
392
393 format_writer.print("[{}] ", DiagTimestamp{});
394 auto timestamp_offset = format_writer.size();
395
396 format_writer.print("{} {}: ", DiagThreadname{}, level_name(diags_level));
397
398 if (location(loc, show_location, diags_level)) {
399 format_writer.print("<{}> ", *loc);
400 }
401
402 if (debug_tag) {
403 format_writer.print("({}) ", debug_tag);
404 }
405
406 format_writer.print("{}", format_string);
407
408 format_writer.restore(2); // restore the space for required termination.
409 if (format_writer.view().back() != '\n') { // safe because always some chars in the buffer.
410 format_writer.write('\n');
411 }
412 format_writer.write('\0');
413
414 return timestamp_offset;
415}

Callers

nothing calls this directly

Calls 7

locationFunction · 0.85
restrictMethod · 0.45
printMethod · 0.45
sizeMethod · 0.45
restoreMethod · 0.45
viewMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected