Handle increments the appropriate counter and passes the record to the next handler.
(ctx context.Context, record slog.Record)
| 66 | |
| 67 | // Handle increments the appropriate counter and passes the record to the next handler. |
| 68 | func (h *PrometheusHandler) Handle(ctx context.Context, record slog.Record) error { |
| 69 | // Increment the counter for this log level |
| 70 | h.messageCounterVec.WithLabelValues(record.Level.String()).Inc() |
| 71 | |
| 72 | // Pass the record to the next handler in the chain |
| 73 | return h.Handler.Handle(ctx, record) |
| 74 | } |
| 75 | |
| 76 | // Enabled delegates to the wrapped handler. |
| 77 | func (h *PrometheusHandler) Enabled(ctx context.Context, level slog.Level) bool { |
no test coverage detected