Documentation ¶
Index ¶
- Variables
- func EventAdder(logger *slog.Logger, prefix string, ...) func(Context, *event.Event, error)
- func EventAttrs(ctx Context, ev *event.Event, err error) []slog.Attr
- func EventRecord(ctx Context, level slog.Level, msg string, ev *event.Event, err error) slog.Record
- func HTTPSpanStarter(logger *slog.Logger, prefix string) func(*http.Request, string, ...*trace.Link) (Context, func(Context))
- func Source(s source.Source, logger *slog.Logger) source.Source
- func SpanStarter(logger *slog.Logger, prefix string) func(Context, api.Op, ...*trace.Link) (Context, func(Context))
- type EventLevels
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultEventLevels = EventLevels{ FailInternal: slog.LevelError, Fail: slog.LevelInfo, Error: slog.LevelInfo, Other: slog.LevelInfo, }
Functions ¶
func EventAdder ¶
func EventAdder(logger *slog.Logger, prefix string, levels func(*event.Event, error) slog.Level) func(Context, *event.Event, error)
EventAdder returns a function which can be used as AddEvent callback. Internal errors are logged at error level, and other events at info level. If logger is nil, current default logger is used for each log record. If levels is nil, defaults are used.
func EventAttrs ¶
EventAttrs converts an event into log attributes.
func EventRecord ¶
EventRecord creates a loggable representation of a server event.
func HTTPSpanStarter ¶
func HTTPSpanStarter(logger *slog.Logger, prefix string) func(*http.Request, string, ...*trace.Link) (Context, func(Context))
HTTPSpanStarter returns a function which can be used as webserver.Config.StartSpan callback.
Types ¶
Click to show internal directories.
Click to hide internal directories.