Skip to main content

Module console_line

Module console_line 

Source
Expand description

Hardware-free: builds and is tested on the host too. Console line formatting, hardware-free so it is host-tested.

A log record is formatted into a fixed [LINE_CAP] buffer, which the caller owns, before it enters the ring. heapless::String refuses a push_str that does not fit WHOLE, so formatting straight into it dropped an over-long argument without a trace: [csv-hdr] arrived with nothing after it. [format_into] cuts at the last character that fits and says so with [TRUNC_MARK]. Records longer than one line go through console::send_record, which has no line buffer at all.

Constants§

HEADER_CAP
Longest [SSSSS.mmm LEVEL] header: a u64 second count is 20 digits.
LINE_CAP
Per-line format buffer for the log path.
TRUNC_MARK
Ends a line format_into had to cut. ASCII, so it renders anywhere.

Functions§

format_into
One CRLF-terminated line into line, replacing what it held: header, then args as far as they fit. A cut line ends in TRUNC_MARK, so a missing tail is visible, never silent. In place, so the caller decides where the line lives: no line buffer is ever on the stack of the code that logs.
header
[SSSSS.mmm LEVEL] , the header every console line starts with.