Documentation ¶
Index ¶
- Variables
- func AuthToken(logger util.Logger, secret string) echo.MiddlewareFunc
- func DefaultSkipper(echo.Context) bool
- func GetPrometheusLogHandler() echo.HandlerFunc
- func Logger(logger util.Logger) echo.MiddlewareFunc
- func LoggerWithConfig(config LoggerConfig) echo.MiddlewareFunc
- func Metrics() echo.MiddlewareFunc
- func Recover() echo.MiddlewareFunc
- func RecoverWithConfig(config RecoverConfig) echo.MiddlewareFunc
- type LoggerConfig
- type RecoverConfig
- type Skipper
- type TokenConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultRecoverConfig is the default Recover middleware config. DefaultRecoverConfig = RecoverConfig{ Skipper: DefaultSkipper, StackSize: 4 << 10, DisableStackAll: false, DisablePrintStack: false, } )
View Source
var (
ErrToken = util.NewError(400403, "invalid token")
)
Functions ¶
func DefaultSkipper ¶
func DefaultSkipper(echo.Context) bool
DefaultSkipper returns false which processes the middleware.
func GetPrometheusLogHandler ¶
func GetPrometheusLogHandler() echo.HandlerFunc
func LoggerWithConfig ¶
func LoggerWithConfig(config LoggerConfig) echo.MiddlewareFunc
LoggerWithConfig returns a Logger middleware with config.
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 LoggerConfig ¶
type LoggerConfig struct { // Skipper defines a function to skip middleware. Skipper Skipper Logger util.Logger Format logrus.Formatter }
LoggerConfig defines the config for Logger middleware.
func NewConfig ¶
func NewConfig(logger util.Logger) LoggerConfig
type RecoverConfig ¶
type RecoverConfig struct { // Skipper defines a function to skip middleware. Skipper Skipper // Size of the stack to be printed. // Optional. Default value 4KB. StackSize int `json:"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 `json:"disable_stack_all"` // DisablePrintStack disables printing stack trace. // Optional. Default value as false. DisablePrintStack bool `json:"disable_print_stack"` }
RecoverConfig defines the config for Recover middleware.
type Skipper ¶
type Skipper func(c echo.Context) bool
Skipper defines a function to skip middleware. Returning true skips processing
type TokenConfig ¶ added in v0.1.2
TokenConfig defines the config for Auth middleware.
Click to show internal directories.
Click to hide internal directories.