Documentation
¶
Overview ¶
Package logbuffer provides an in-memory, fixed-capacity ring buffer of log lines that satisfies io.Writer, so it can be teed into zerolog alongside the real stdout output. The desktop (Wails) app plugs it into the global logger at startup and exposes the captured lines through the Settings "Logs" modal (view + save to a JSON file). Like the agent's metrics history, the buffer is intentionally not persisted — it is scoped to the process lifetime and lost on restart.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is a thread-safe ring buffer of the most recent log lines. Each call to Write stores one entry (zerolog emits exactly one complete JSON object, newline-terminated, per write); once max entries are held, the oldest are dropped. Logs are written from many goroutines (deploy, sync, tunnel workers), so — unlike the single-user metadata store — this genuinely needs its own lock.
func New ¶
New returns a Buffer that retains at most max entries (a non-positive max falls back to a sane default).