Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultRecoverConfig is the default Recover middleware config. DefaultRecoverConfig = RecoverConfig{ Skipper: middleware.DefaultSkipper, StackSize: 4 << 10, DisableStackAll: false, DisablePrintStack: false, } )
Functions ¶
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()`.
func SaveLogRequest ¶
func SaveLogRequest() middleware.BodyDumpHandler
Save log request to file, dont forget to initiate SetLogRequest middleware before using this middleware. Use echo body dump when initiate this middleware. echo.Use(middleware.BodyDump(logMiddleware.SaveLogRequest())).
func SetLogRequest ¶
func SetLogRequest() echo.MiddlewareFunc
SetLogRequest is used for save log request model to echo locals as context.
Types ¶
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"`
}
RecoverConfig defines the config for Recover middleware.
Click to show internal directories.
Click to hide internal directories.