Expand description
Zero-dependency logfmt parser.
Parses the logfmt key=value format used by
Heroku, Go’s logrus, and many other structured logging libraries.
Supported syntax:
| Input | Key | Value |
|---|---|---|
key=value | key | "value" |
key="quoted val" | key | "quoted val" |
key= | key | "" |
key | key | "true" |
key="esc\"ape" | key | esc"ape |
key="back\\slash" | key | back\slash |
§Example
use rsigma_runtime::parse::logfmt::parse;
let pairs = parse(r#"level=info msg="request handled" duration=12ms"#);
assert_eq!(pairs.len(), 3);
assert_eq!(pairs[0], ("level".into(), "info".into()));
assert_eq!(pairs[1], ("msg".into(), "request handled".into()));
assert_eq!(pairs[2], ("duration".into(), "12ms".into()));Functions§
- parse
- Parse a logfmt line into key-value pairs.