Documentation
¶
Overview ¶
Package logbuf keeps the agent's most recent log output in memory so it can be read back after the fact, there being no stderr to read when the agent is started from a desktop launcher.
Index ¶
Constants ¶
const DefaultCapacity = 5000
DefaultCapacity is the number of entries kept when none is specified.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
// Seq is monotonic in write order, so a reader can ask for only what
// followed the last entry it saw.
Seq uint64 `json:"seq"`
Time time.Time `json:"time"`
Level Level `json:"level"`
Source string `json:"source,omitempty"` // logger prefix, e.g. "[agent]"
Message string `json:"message"`
}
Entry is one captured log line.
type Level ¶
type Level string
Level is the severity inferred for a log line. The agent logs without levels, so this is recovered from the text — good enough to drive a filter, not to be relied on for control flow.
type Ring ¶
type Ring struct {
// contains filtered or unexported fields
}
Ring is a bounded, concurrency-safe buffer of the most recent log entries. It implements io.Writer and fans each entry out to subscribers.
func New ¶
New returns a Ring holding up to capacity entries. Non-positive capacity falls back to DefaultCapacity.
func (*Ring) Since ¶
Since returns the buffered entries with Seq greater than seq, oldest first. A caller whose seq predates the ring receives only what survives.