Documentation ¶
Index ¶
- Constants
- func Logger(log *zap.Logger) echo.MiddlewareFunc
- func LoggerWithConfig(log *zap.Logger, config LoggerConfig) echo.MiddlewareFunc
- func Recover(log *zap.Logger) echo.MiddlewareFunc
- func RecoverWithConfig(log *zap.Logger, config RecoverConfig) echo.MiddlewareFunc
- type LoggerConfig
- type RecoverConfig
Constants ¶
View Source
const DefaultLoggerMsg = "Served"
View Source
const DefaultRecoverMsg = "Recovered"
View Source
const DefaultRequestIDHeader = echo.HeaderXRequestID
Variables ¶
This section is empty.
Functions ¶
func LoggerWithConfig ¶
func LoggerWithConfig(log *zap.Logger, config LoggerConfig) echo.MiddlewareFunc
func RecoverWithConfig ¶
func RecoverWithConfig(log *zap.Logger, config RecoverConfig) echo.MiddlewareFunc
Types ¶
type LoggerConfig ¶
type LoggerConfig struct { // Only log requests that respond with a status code of // 3XX, 4XX, or 5XX, or when the handler returns an error. ErrorOnly bool // Skip the current request depending on the context. Skipper func(c echo.Context) bool // Custom string for the `msg` field CustomMsg string // Don't omit the `caller` field. By default, caller will not be printed. // // Caller gets printed as `zap4echo/logger.go:121`. That is redundant. IncludeCaller bool // If true, printing of stack trace will be disabled. OmitStackTrace bool // If true, particular field will not be printed. OmitStatusText bool OmitClientIP bool OmitUserAgent bool OmitPath bool OmitRequestID bool OmitReferer bool // Custom header name for request ID CustomRequestIDHeader string // A function for adding custom fields depending on the context. FieldAdder func(c echo.Context) []zapcore.Field }
type RecoverConfig ¶
type RecoverConfig struct { // Custom string for the `msg` field CustomMsg string // Set this to true to enable stack trace. // `stacktrace` field will be used to print stack trace. StackTrace bool // Size allocated on memory for stack trace. StackTraceSize int // If stack trace is enabled, this is to print stack traces of all goroutines. PrintStackTraceOfAllGoroutines bool // Custom header name for request ID CustomRequestIDHeader string // A function for adding custom fields depending on the context. FieldAdder func(c echo.Context, err error) []zap.Field // The panic was happened, and it was handled and logged gracefully. // What's next? // // This function is called to handle the error of panic. ErrorHandler func(c echo.Context, err error) }
Click to show internal directories.
Click to hide internal directories.