logfields

package
v0.0.0-...-dfadc02 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 4 Imported by: 0

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

func Enrich(r domain.Record) domain.Record

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

func Parse(line []byte) map[string]any

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL