middleware

package
v0.27.0-rc.9 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// HeaderUserID is the HTTP header where the user ID is stored.
	HeaderUserID = "X-ID"
	// HeaderTenantID is the HTTP header where the tenant ID is stored.
	HeaderTenantID = "X-Tenant-ID"
)

Variables

This section is empty.

Functions

func Log

func Log(next echo.HandlerFunc) echo.HandlerFunc

Log is the echo middleware that logs one line per request, with the user and tenant taken from the headers named above. It measures with the wall clock deliberately: this is elapsed time, not a timestamp a test needs to control.

It runs the error handler itself rather than returning the error, so the status that handler writes is already on the response by the time the line is built, and it unwraps echo's [http.ResponseWriter] to read that status and the byte count back out.

func NewSlogLogger

func NewSlogLogger(logger *logrus.Entry) *slog.Logger

NewSlogLogger returns the logger Echo writes its internals to, backed by logrus so the framework's own messages land in the same stream and format as everything else ShellHub logs.

Types

This section is empty.

Jump to

Keyboard shortcuts

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