Skip to main content

Module parser

Module parser 

Source
Expand description

Line-by-line parser for structured JSON log input.

The single entry point parse_line takes one line of text and returns Some(LogEntry) if the line is a JSON object, or None otherwise. It never panics and never returns an error: malformed input is silently skipped, as mandated by the project doc’s parser task (“graceful skip on malformed lines”) and reinforced by the v1 scope note that logdive accepts structured JSON only — non-JSON lines are simply not its concern.

Known keys (timestamp, level, message, tag) are lifted into the corresponding LogEntry fields. All other top-level keys are preserved in LogEntry::fields for json_extract()-based querying downstream.

Functions§

parse_line
Parse a single line of JSON log input.