Documentation
¶
Overview ¶
Package boot provides console log parsing and boot diagnostics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WatchEvents ¶ added in v0.2.0
func WatchEvents(ctx context.Context, path string, opts WatchOptions) <-chan Event
WatchEvents tails the file at path and emits one Event per new line. The returned channel is closed when ctx is canceled. It blocks while waiting for the file to appear and recovers from truncation/rotation by reopening when the file shrinks.
Unlike WatchFile, this function does not stop on its own — callers control the lifetime via ctx so they can keep streaming console output even after boot is "healthy" (the tail is still useful for diagnosing later failures).
Types ¶
type Event ¶ added in v0.2.0
Event is a single observation made while tailing a console log. Line is the raw text (no trailing newline). Status is the accumulated boot status as of this line — a stable snapshot the caller may keep references to.
type Status ¶
type Status struct {
KernelBooted bool
SystemdReached bool
CloudInitDone bool
CloudInitFailed bool
SSHReady bool
IncusReady bool
LoginPrompt bool
KernelPanic bool
EmergencyMode bool
// Errors detected during boot
Errors []string
// LastActivity timestamp detected
LastActivity time.Time
}
Status represents the detected boot state from console output.
func ParseReader ¶
ParseReader parses boot status from a reader (console log).
type WatchOptions ¶ added in v0.2.0
type WatchOptions struct {
// PollInterval is how often to re-stat the file. Required.
PollInterval time.Duration
// FromEnd seeks to the end of the file on initial open so only content
// appended after WatchEvents starts is emitted. Useful when the log may
// already contain stale content from a previous run.
FromEnd bool
}
WatchOptions configures WatchEvents.