Expand description
Journal access for the log view.
Spawns journalctl as a one-shot subprocess with --output=json rather
than linking sd-journal bindings: no libsystemd build dependency, and the
JSON output carries PRIORITY reliably, which drives the coloring.
Multi-line messages (scheduler Opts { ... } dumps and the like) are
flattened into display lines here, with continuations marked so the UI
can indent or fold them.
Re-exportsΒ§
use anyhow::Context;πuse anyhow::Result;πuse anyhow::bail;πuse chrono::TimeZone;πuse crate::system::system_command;π
StructsΒ§
- LogFetch
- Result of one journal fetch: flattened display lines plus whether the tail limit cut the beginning off, so the UI can say so.
- LogLine
- One display line of the log view.
ConstantsΒ§
- MAX_
ENTRIES π - Tail limit for a single journal fetch. Without it, a chatty scheduler
on a long-running boot can hand back tens of megabytes of JSON, all
parsed synchronously while the UI is frozen. The newest entries are
what the view opens on anyway; anything older is
journalctlβs job. - UNIT
- The unit the log view inspects: the scheduler runs as its main process, so its stdout/stderr land in the unitβs journal.
FunctionsΒ§
- fetch
- Fetches the journal tail for
unit(up toMAX_ENTRIESentries), current boot or the previous one, and flattens it into display lines (oldest first). - format_
local_ πtime - parse_
entries π - Pure parsing core: one
journalctl --output=jsonline per entry in, flattened display lines out. Malformed entries are skipped rather than failing the whole view.