Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RequestLogFormatter ¶
A RequestLogFormatter takes the HTTP request, the resulting HTTP status code and latency and formats the log entry.
var DefaultRequestLogFormatter RequestLogFormatter = &defaultRequestLogFormatter{}
DefaultRequestLogFormatter is the default RequestLogFormatter. It logs the request's HTTP method and the path, the response's status code and the latency of the request.
type RequestLogFormatterFunc ¶
type RequestLogFormatterFunc func(r *http.Request, statusCode int, latency time.Duration) []slog.Attr
The RequestLogFormatterFunc type is an adapter that allows an ordinary function to be used as a RequestLogFormatter.
func (RequestLogFormatterFunc) FormatRequest ¶
func (f RequestLogFormatterFunc) FormatRequest(r *http.Request, statusCode int, latency time.Duration) []slog.Attr
FormatRequest calls f(r, statusCode, latency)
Click to show internal directories.
Click to hide internal directories.