Documentation ¶
Overview ¶
Package logger logs http responses See: https://github.com/elithrar/admission-control/blob/v0.6.7/request_logger.go#L40
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
FromContext returns the *slog.Logger previously stored in ctx by NewContext. slog.Default() is returned otherwise.
func GetClientIP ¶
GetClientIP returns the client address from the x-forwarded-for header or the http.Request RemoteAddr field.
func LoggingMiddleware ¶
LoggingMiddleware returns a handler that adds a *slog.Logger to the request context.Context retrievable by FromContext. The returned handler is useful as the outer client facing edge of a middleware chain and includes attributes on the log messages.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.