middleware

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package middleware provides Fiber middleware: recover, request logging, and request IDs.

Index

Constants

View Source
const (
	// RequestIDKey is the context key used to store and retrieve the request ID.
	RequestIDKey contextKey = "request_id"
)

Variables

This section is empty.

Functions

func ContextMiddleware

func ContextMiddleware(timeout time.Duration) fiber.Handler

ContextMiddleware attaches a timeout-bounded context and a unique request ID to every incoming Fiber request, storing both via c.Locals.

func Recover

func Recover(logger *logger.Logger) fiber.Handler

Recover is a middleware that recovers from panics and logs the error.

func RequestLogger

func RequestLogger(logger *logger.Logger) fiber.Handler

RequestLogger is a middleware that logs information about each request. When the request carries a valid OTel span context, it adds trace_id and span_id fields so logs can be correlated with traces.

Types

This section is empty.

Jump to

Keyboard shortcuts

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