Expand description
Lossless parsing of Linux kernel panic logs, including incomplete excerpts.
parse accepts any AsRef<str> input and owns its result. Unknown lines,
architecture-specific details, whitespace, and line endings are preserved.
PanicLog’s display output is byte-for-byte identical to its input, so
parse(log.to_string()) == log for every valid UTF-8 input.
use linux_kernel_panic_parser::{parse, LineKind};
let log = parse("[ 1.250000] Kernel panic - not syncing: fatal exception\n");
assert_eq!(log.panic_messages().collect::<Vec<_>>(), ["fatal exception"]);
assert_eq!(parse(log.to_string()), log);
assert!(matches!(log.lines()[0].kind(), LineKind::Panic { .. }));No architecture is inferred from the machine running this library. Register
names and hexadecimal addresses are retained as strings with no word-size
limit. Recognition is best effort: this is not a validator for every kernel
version or log transport. Syslog/journal wrappers remain raw text; uptime
extraction supports the usual leading printk/dmesg [seconds.fraction] form
and [unix_seconds][seconds.fraction] pairs.
Structs§
- LogLine
- One line, including its original terminator (LF, CRLF, CR, or none).
- Panic
Log - An owned, lossless log. It may contain zero, one, or multiple panics.
- Register
- A register value retained without integer-width assumptions.
- Stack
Frame - A stack symbol. Textual numbers preserve padding and support any word size.
Enums§
- Line
Kind - Recognized architecture-independent records. Unrecognized records are kept.
Functions§
- parse
- Parse any borrowed or owned string-like input into an owned log.