Documentation
¶
Overview ¶
Package logfields extracts common fields from a text log line, best-effort: a leading timestamp, a level token, and logfmt key=value pairs. It is an optional adapter that sits above a text source; a line it cannot read still flows through untouched, with its raw bytes intact.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Enrich ¶
Enrich returns r with the fields parsed from its Data merged into Fields and Kind set to KindLog. Existing Fields win over parsed ones, and the raw Data is left untouched. A line nothing is extracted from returns r unchanged, so it stays a usable record.
func Parse ¶
Parse reads a log line into a field map, best-effort. It recognizes logfmt key=value pairs anywhere in the line, a leading RFC3339 timestamp, and a leading level word (info, error, warn, ...). It never errors; an unrecognized line yields nil, and nothing is allocated until a field is found.
Types ¶
This section is empty.