NewContextHandler wraps a slog handler so records include attributes carried by context.
(handler slog.Handler)
| 47 | |
| 48 | // NewContextHandler wraps a slog handler so records include attributes carried by context. |
| 49 | func NewContextHandler(handler slog.Handler) slog.Handler { |
| 50 | return &contextHandler{handler: handler} |
| 51 | } |
| 52 | |
| 53 | func (h *contextHandler) Enabled(ctx context.Context, level slog.Level) bool { |
| 54 | return h.handler.Enabled(ctx, level) |
no outgoing calls