requestlog

package
v0.0.0-...-9d642ba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2024 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMiddleware

func NewMiddleware(opts ...Option) func(http.Handler) http.Handler

NewMiddleware returns an http.Handler middleware that logs requests in GCP structured format using slog. With slog.JSONHandler used as the handler, logs will be rendered on the GCP console with rich information about the HTTP request.

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option is a configuration option for NewMiddleware.

func Logger

func Logger(l *slog.Logger) Option

Logger returns an Option to set the slog.Logger used by the middleware. If not provided, the default logger is used.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL