middleware

package
v0.0.0-...-4844c50 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const PprofCPUOutput = "cpu.prof"
View Source
const PprofMemOutput = "mem.prof"

Variables

This section is empty.

Functions

func Logger

func Logger(logger *slog.Logger, next http.Handler) http.Handler

Logger logs incoming request in a standardized format.

method=POST url=/users.get status=200 size=42 duration=10ms

The middleware inject a [LogFields] object into the context allowing the next handlers to add custom fields to the log line:

method=POST url=/users.get status=200 size=42 duration=10ms team=xxxx-xxxx-xxxx-xxxxxxxx

func Pprof

func Pprof(logger *slog.Logger, next http.Handler) http.Handler

Types

This section is empty.

Jump to

Keyboard shortcuts

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