middlewares

package
v0.0.0-...-2c15619 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const LogExtra = "Log_Extra"

Variables

View Source
var (
	// DefaultRecoverConfig is the default Recover middleware config.
	DefaultRecoverConfig = RecoverConfig{
		Skipper:           middleware.DefaultSkipper,
		StackSize:         4 << 10,
		DisableStackAll:   false,
		DisablePrintStack: false,
		LogLevel:          0,
	}
)
View Source
var WrapHandler = wrapHandler(swaggerFiles.Handler)

WrapHandler wraps swaggerFiles.Handler and returns echo.HandlerFunc

Functions

func BindEchoContext

func BindEchoContext(c echo.Context, logger logger.Logger) context.Context

func Correlation

func Correlation() echo.MiddlewareFunc

func Logger

func Logger(log logger.Logger) echo.MiddlewareFunc

func NewHttpErrorHandler

func NewHttpErrorHandler() *httpErrorHandler

func Recover

func Recover() echo.MiddlewareFunc

Recover returns a middleware which recovers from panics anywhere in the chain and handles the control to the centralized HTTPErrorHandler.

func RecoverWithConfig

func RecoverWithConfig(config RecoverConfig) echo.MiddlewareFunc

RecoverWithConfig returns a Recover middleware with config. See: `Recover()`.

Types

type HttpErrorHandler

type HttpErrorHandler interface {
	Add(err error, code int)
	// contains filtered or unexported methods
}

type RecoverConfig

type RecoverConfig struct {
	// Skipper defines a function to skip middleware.
	Skipper middleware.Skipper

	// Size of the stack to be printed.
	// Optional. Default value 4KB.
	StackSize int `yaml:"stack_size"`

	// DisableStackAll disables formatting stack traces of all other goroutines
	// into buffer after the trace for the current goroutine.
	// Optional. Default value false.
	DisableStackAll bool `yaml:"disable_stack_all"`

	// DisablePrintStack disables printing stack trace.
	// Optional. Default value as false.
	DisablePrintStack bool `yaml:"disable_print_stack"`

	// LogLevel is log level to printing stack trace.
	// Optional. Default value 0 (Print).
	LogLevel log.Lvl
}

RecoverConfig defines the config for Recover middleware.

type Stats

type Stats struct {
	Statuses map[string]int `json:"statuses"`
	Uptime   time.Time      `json:"uptime"`
}

Jump to

Keyboard shortcuts

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