Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultLoggerConfig is the default Logger middleware config. DefaultLoggerConfig = LoggerConfig{ Format: "=> ${method} | ${remote_ip} | ${host} | ${uri} | ${bytes_in} B in | ${status} | ${bytes_out} B out | ${latency_human} | ${error}", CustomTimeFormat: "2006-01-02 15:04:05.00000", Logger: nil, RecordFailRequest: false, } )
Functions ¶
func LoggerWithConfig ¶
func LoggerWithConfig(config LoggerConfig) echo.MiddlewareFunc
LoggerWithConfig returns a Logger middleware with config. See: `Logger()`.
func RecoverWithConfig ¶
func RecoverWithConfig(config RecoverConfig) echo.MiddlewareFunc
RecoverWithConfig returns a Recover middleware with config. See: `Recover()`.
Types ¶
type LoggerConfig ¶
type LoggerConfig struct {
// Tags to construct the logger format.
//
// - time_unix
// - time_unix_nano
// - time_rfc3339
// - time_rfc3339_nano
// - time_custom
// - id (Request ID)
// - remote_ip
// - uri
// - host
// - method
// - path
// - protocol
// - referer
// - user_agent
// - status
// - error
// - latency (In nanoseconds)
// - latency_human (Human readable)
// - bytes_in (Bytes received)
// - bytes_out (Bytes sent)
// - header:<NAME>
// - query:<NAME>
// - form:<NAME>
//
// Example "${remote_ip} ${status}"
//
// Optional. Default value DefaultLoggerConfig.Format.
Format string `yaml:"format"`
// Optional. Default value DefaultLoggerConfig.CustomTimeFormat.
CustomTimeFormat string `yaml:"custom_time_format"`
Logger log.Logger
RecordFailRequest bool
// contains filtered or unexported fields
}
LoggerConfig defines the config for Logger middleware.
type RecoverConfig ¶
type RecoverConfig struct {
OnPanic func(panic_err interface{})
}
RecoverConfig defines the config for Recover middleware.
Click to show internal directories.
Click to hide internal directories.