Bounded, color-coded log view that tails like
tail -f.
glyph add log-streamThis copies log-stream.go (and its test file) into your repo at the path your
glyph.json aliases declare. After install, the file is yours: edit it,
refactor it, rename it. There is no log-stream library to keep in sync.
package main
import (
"fmt"
logstream "github.com/truffle-dev/glyph/components/log-stream"
"github.com/truffle-dev/glyph/components/theme"
)
func main() {
s := logstream.New(theme.Default).
WithSize(96, 16).
WithMinLevel(logstream.LevelInfo)
s = s.Append(logstream.Entry{
Level: logstream.LevelWarn,
Source: "auth",
Message: "deprecated token format",
})
fmt.Println(s.View())
}Package: logstream
Types
LevelEntryStream
Functions and methods
StringNewWithCapacityWithSizeWithMinLevelWithTimestampsWithTimeFormatAppendClearEntriesOffsetInitUpdateView
- glyph component
theme(installed automatically) github.com/charmbracelet/bubbletea@v1.3.10github.com/charmbracelet/lipgloss@v1.1.0github.com/muesli/reflow@v0.3.0
Call Append(Entry{Time, Level, Source, Message}) on every new log line. The view auto-tails unless the user has scrolled up. WithCapacity caps the ring; WithMinLevel hides entries below the threshold (the buffer is unchanged).
- examples/showcase — single-binary TUI composing the seven main surfaces
- components/log-stream/story — runnable story binary (
go run -tags glyph_story ./components/log-stream/story/) - registry manifest — the JSON contract
glyph addreads
MIT, same as the rest of glyph.
