Documentation
¶
Overview ¶
Package logtail keeps a bounded, in-memory ring of a process's recent log lines, with a live tap for followers. It is an io.Writer teed into the zerolog output, capturing each event's JSON without touching the real sink.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is a bounded, concurrency-safe ring of recent log lines with a live tap. The zero value is not usable; build one with New.
func Default ¶
func Default() *Buffer
Default returns the process-wide buffer (a disabled one until SetDefault runs).
func New ¶
New returns a Buffer holding up to capacity entries. A capacity <= 0 yields a disabled buffer (Write is a no-op).
func (*Buffer) Read ¶
Read returns the entries matching f, newest first. The bool reports whether more matched than were returned.
func (*Buffer) ReadAndSubscribe ¶
ReadAndSubscribe snapshots the matching backlog (oldest first) and registers a live subscriber under one lock, so no line is missed or duplicated in the gap. cancel must be called; it unsubscribes and closes live.