Documentation
¶
Index ¶
- func BySerialDesc(i, j Message) int
- type Attr
- type Enricher
- type Interface
- type Logger
- func (e Logger) AddEnricher(enricher Enricher)
- func (l *Logger) Debug(msg string, args ...any)
- func (l *Logger) Error(msg string, args ...any)
- func (l *Logger) Get(id resource.ID) (Message, error)
- func (l *Logger) Info(msg string, args ...any)
- func (l *Logger) List() []Message
- func (l *Logger) Warn(msg string, args ...any)
- type Message
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BySerialDesc ¶
BySerialDesc sorts log messages by their serial.
Types ¶
type Interface ¶
type Interface interface {
Debug(msg string, args ...any)
Info(msg string, args ...any)
Warn(msg string, args ...any)
Error(msg string, args ...any)
AddEnricher(enricher Enricher)
}
var Discard Interface = &noop{}
type Logger ¶
Logger wraps slog, providing further functionality such as emitting log records as pug events, and enriching records with further attributes.
func (Logger) AddEnricher ¶
func (e Logger) AddEnricher(enricher Enricher)
type Message ¶
type Message struct {
Time time.Time
Level string
Message string `json:"msg"`
Attributes []Attr
// Serial uniquely identifies the message (within the scope of the logger it
// was emitted from). The higher the Serial number the newer the message.
Serial uint
// A message is a pug resource, but only insofar as it makes it easier to
// handle consistently alongside all other resources (modules, workspaces,
// etc) in the TUI.
//
// TODO: consider making resource an interface rather than a struct. A log
// message doesn't need a UUID, and the serial above is sufficient.
resource.Resource
}
Message is the event payload for a log message
Click to show internal directories.
Click to hide internal directories.