Documentation
¶
Index ¶
- func New(opts *slog.HandlerOptions, parent slog.Handler) slog.Handler
- func WithAttributes(ctx context.Context, args ...any) context.Context
- type RequestLogHandler
- type SHandler
- func (s *SHandler) Enabled(_ context.Context, lvl slog.Level) bool
- func (s *SHandler) Handle(ctx context.Context, r slog.Record) error
- func (s *SHandler) SetHttpClient(client *http.Client)
- func (s *SHandler) SetTarget(targetUrl string)
- func (s *SHandler) WithAttrs(attrs []slog.Attr) slog.Handler
- func (s *SHandler) WithGroup(name string) slog.Handler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RequestLogHandler ¶ added in v0.2.0
RequestLogHandler is a http handler that will log every requests it handles into slog. It will also update request.Context to return the request information so it will be populated in messages sent via slog.
func (*RequestLogHandler) ServeHTTP ¶ added in v0.2.0
func (r *RequestLogHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)
type SHandler ¶
type SHandler struct {
// contains filtered or unexported fields
}
func (*SHandler) SetHttpClient ¶ added in v0.3.0
SetHttpClient sets the HTTP client to use to send requests
Click to show internal directories.
Click to hide internal directories.