middleware

package
v0.0.0-...-e55fb6d Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRequestID

func GetRequestID(c echo.Context) string

GetRequestID returns the request identifier

func NewLogger

func NewLogger(logger *slog.Logger) echo.MiddlewareFunc

NewLogger returns a echo.MiddlewareFunc (middleware) that logs requests using slog.

Requests with errors are logged using slog.Error(). Requests without errors are logged using slog.Info().

func NewLoggerWithConfig

func NewLoggerWithConfig(logger *slog.Logger, config Config) echo.MiddlewareFunc

NewLoggerWithConfig returns a echo.HandlerFunc (middleware) that logs requests using slog.

func OpenTelemetry

func OpenTelemetry() echo.MiddlewareFunc

func RequestIDConfig

func RequestIDConfig() middleware.RequestIDConfig

func RequestMetrics

func RequestMetrics() echo.MiddlewareFunc

func Skipper

func Skipper(c echo.Context) bool

Types

type Config

type Config struct {
	DefaultLevel     slog.Level
	ClientErrorLevel slog.Level
	ServerErrorLevel slog.Level

	WithRequestID bool
}

Jump to

Keyboard shortcuts

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