Documentation
¶
Overview ¶
Package tuilog provides a custom slog.Handler that captures log entries into an in-memory ring buffer and optionally sends warn/error entries to a channel for TUI toast display.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
Time time.Time
Level slog.Level
Message string
Attrs string // pre-formatted key=value pairs
}
Entry is a single captured log record.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is a slog.Handler that writes to a Store and pushes warn/error entries onto a channel for TUI toast display.
func NewHandler ¶
func NewHandler(store *Store, toasts chan<- ToastEntry) *Handler
NewHandler creates a Handler that captures to the given store. Entries at or above toastLevel are also sent to the toasts channel. The channel should be buffered to avoid blocking the caller.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a thread-safe ring buffer of log entries.
type ToastEntry ¶
ToastEntry is sent over the toast channel for warn/error log entries.