Documentation
¶
Overview ¶
Package logging configures the standard library's structured slog logger.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseLevel ¶
ParseLevel converts a common level name to slog.Level and defaults to info.
Types ¶
type Config ¶
type Config struct {
Level slog.Level
Format Format
AddSource bool
Output io.Writer
Stream *Stream
}
Config configures a slog logger suitable for AstraEngine.
type Format ¶
type Format string
Format selects the structured log encoding.
func ParseFormat ¶
ParseFormat converts a format name to Format and defaults to text.
type Stream ¶ added in v2.0.1
type Stream struct {
// contains filtered or unexported fields
}
Stream broadcasts structured log records without blocking their producer.
func NewStream ¶ added in v2.0.1
NewStream creates a stream with a bounded queue for each subscriber.
func (*Stream) Close ¶ added in v2.0.1
func (s *Stream) Close()
Close stops the stream and closes every subscriber channel.
func (*Stream) Done ¶ added in v2.0.1
func (s *Stream) Done() <-chan struct{}
Done is closed when the stream is closed.
func (*Stream) Publish ¶ added in v2.0.1
Publish offers a record to every subscriber, dropping it for full queues.
func (*Stream) Subscribe ¶ added in v2.0.1
Subscribe returns a log channel and an idempotent unsubscribe function.
func (*Stream) SubscriberCount ¶ added in v2.0.1
SubscriberCount reports the number of active subscribers.