Documentation
¶
Overview ¶
Package protocol defines the wire records and filters used by DevLogBus.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LevelValue ¶
LevelValue returns the slog-compatible numeric value for a level.
func NormalizeLevel ¶
NormalizeLevel canonicalizes common log-level spellings.
Types ¶
type Envelope ¶
type Envelope struct {
Type MessageType `json:"type"`
Record *Record `json:"record,omitempty"`
Subscribe *Subscribe `json:"subscribe,omitempty"`
Expunge *Expunge `json:"expunge,omitempty"`
ExpungeResult *ExpungeResult `json:"expungeResult,omitempty"`
Error string `json:"error,omitempty"`
}
Envelope is one newline-delimited JSON message on the broker socket.
type Expunge ¶
type Expunge struct {
Source string `json:"source,omitempty"`
}
Expunge describes a broker replay-buffer delete request.
type ExpungeResult ¶
type ExpungeResult struct {
Expunged int `json:"expunged"`
}
ExpungeResult describes the outcome of a replay-buffer delete request.
type MessageType ¶
type MessageType string
MessageType identifies an envelope payload kind.
const ( // MessageTypeLog carries a structured log record. MessageTypeLog MessageType = "log" // MessageTypeSubscribe carries a subscription request. MessageTypeSubscribe MessageType = "subscribe" // MessageTypeReplayComplete marks the end of the initial replay batch. MessageTypeReplayComplete MessageType = "replay_complete" // MessageTypeExpunge carries a request to delete replay-buffer records. MessageTypeExpunge MessageType = "expunge" // MessageTypeExpungeResult carries the count of deleted replay-buffer records. MessageTypeExpungeResult MessageType = "expunge_result" // MessageTypeError carries a broker-side error. MessageTypeError MessageType = "error" )
type Record ¶
type Record struct {
ID string `json:"id,omitempty"`
Time time.Time `json:"time"`
Level string `json:"level"`
Source string `json:"source"`
Message string `json:"message"`
Attrs map[string]any `json:"attrs,omitempty"`
}
Record is a structured log event.
Click to show internal directories.
Click to hide internal directories.