Documentation
¶
Overview ¶
Package uilog plumbs the stdlib log package into both a file and a TUI subscriber so TUI sessions don't have log lines smeared across the altscreen buffer. Headless runs leave the standard logger alone.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tap ¶
type Tap struct {
// contains filtered or unexported fields
}
Tap is a writer that fans log output to an underlying sink and to any subscribers that want to render the most recent line in a UI. It also remembers the latest line so a late subscriber can paint immediately, and keeps a bounded ring of recent lines so a logs screen opened later can show scrollback without having tailed from the start.
func New ¶
New constructs a Tap that writes to sink. Pass io.Discard if you only want the in-memory tap (e.g. tests). The returned Tap is safe for concurrent use.
func (*Tap) Install ¶
func (t *Tap) Install() func()
Install replaces the standard library logger's output with t and clears timestamp/file flags — the file already carries timestamps from the log.Printf callers, and removing the flags keeps the TUI one-liner uncluttered. Returns a restore func.
func (*Tap) Recent ¶
Recent returns a snapshot of the retained log lines, oldest first. The returned slice is a copy, safe to keep and mutate. It's used to seed the logs screen's scrollback when it's opened.