Skip to main content

format_ai_log_line

Function format_ai_log_line 

pub fn format_ai_log_line(
    timestamp: SystemTime,
    session: Option<&SessionKey>,
    level: &str,
    source: &str,
    message: &str,
) -> String
Expand description

Format one log record line for append to a synthetic AI log buffer. Shape: HH:MM:SS.mmm [<provider>:<index>] <level> <source>: <message>. Trailing newline is the caller’s responsibility (the drain batches many records into one buffer-append).

timestamp is the record’s own emission time, not the format time: :ai-log seeds a buffer from history, and stamping at format time would render every historical line with the moment the buffer happened to be opened.

The clock is UTC ((secs / 3600) % 24), matching lattice_lsp::logging::format_log_event_line; rendering local time would need a timezone dependency neither logger carries.