Skip to main content

Module parse

Module parse 

Source
Expand description

Turning a line of an ant-node log file into a forwardable event.

A node writes one of two layouts depending on --log-format, and the daemon does not set that flag, so a user may have chosen either. Rather than force a format — which would mean adding an argument to every node’s command line and restarting them all just to switch forwarding on — this module detects the layout per line:

text: 2026-08-19T20:50:00.123456Z  INFO ant_node::node: connected peers=3
json: {"timestamp":"2026-08-19T20:50:00.123456Z","level":"INFO","target":"ant_node::node", …}

Lines that are neither — panic messages, backtrace frames, anything a dependency writes straight to the file — are continuations of the event above them rather than events in their own right, and are appended to it. That keeps a multi-line panic intact as one document instead of scattering it across twenty timestamp-less ones.

Structs§

LogEvent
A single parsed log event, before it is tagged with the node’s identity.

Functions§

index_date_from_timestamp
Extract YYYY.MM.DD from an RFC3339 timestamp, validating the shape rather than trusting it.
parse_line
Parse one line, returning None when it is a continuation of the event above it.