Handle implements slog.Handler.
(ctx context.Context, r slog.Record)
| 107 | |
| 108 | // Handle implements slog.Handler. |
| 109 | func (h *lambdaHandler) Handle(ctx context.Context, r slog.Record) error { |
| 110 | if lc, ok := FromContext(ctx); ok { |
| 111 | r.AddAttrs(slog.String("requestId", lc.AwsRequestID)) |
| 112 | |
| 113 | for _, field := range h.fields { |
| 114 | if v := field.value(lc); v != "" { |
| 115 | r.AddAttrs(slog.String(field.key, v)) |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | return h.handler.Handle(ctx, r) |
| 120 | } |
| 121 | |
| 122 | // WithAttrs implements slog.Handler. |
| 123 | func (h *lambdaHandler) WithAttrs(attrs []slog.Attr) slog.Handler { |
nothing calls this directly
no test coverage detected