Documentation
¶
Index ¶
- func Prometheus() echo.MiddlewareFunc
- func PrometheusWithConfig(conf PrometheusConfig) echo.MiddlewareFunc
- func ZapLogger(logger *zap.Logger) echo.MiddlewareFunc
- func ZapLoggerWithConfig(logger *zap.Logger, config LoggerConfig) echo.MiddlewareFunc
- func ZeroLogger(logger zerolog.Logger) echo.MiddlewareFunc
- func ZeroLoggerWithConfig(logger zerolog.Logger, config LoggerConfig) echo.MiddlewareFunc
- type LoggerConfig
- type PrometheusConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Prometheus ¶
func Prometheus() echo.MiddlewareFunc
func PrometheusWithConfig ¶
func PrometheusWithConfig(conf PrometheusConfig) echo.MiddlewareFunc
func ZapLogger ¶
func ZapLogger(logger *zap.Logger) echo.MiddlewareFunc
ZapLogger returns a middleware that logs HTTP requests using Uber Zap with a sane default configuration.
func ZapLoggerWithConfig ¶
func ZapLoggerWithConfig(logger *zap.Logger, config LoggerConfig) echo.MiddlewareFunc
func ZeroLogger ¶
func ZeroLogger(logger zerolog.Logger) echo.MiddlewareFunc
func ZeroLoggerWithConfig ¶
func ZeroLoggerWithConfig(logger zerolog.Logger, config LoggerConfig) echo.MiddlewareFunc
Types ¶
type LoggerConfig ¶
type LoggerConfig struct {
// Skipper defines a function to skip the middleware. The zero-value/default
// is to always execute the middleware.
Skipper middleware.Skipper
// Configures/extracts the value used for the "correlation_id" value that is
// logged. The zero-value/default behavior is to use X-Request-ID from the
// request HTTP header.
CorrelationIDExtractor func(c echo.Context) string
// Controls if HTTP headers are logged for the request and response. The
// zero-value/default behavior is to not log the HTTP headers.
//
// Notice: Logging HTTP headers can contain sensitive information and may
// be a security/privacy risk.
Headers bool
// Controls if the HTTP request body is logged. The zero-value/default behavior
// is to not log the HTTP request body.
//
// Notice: The HTTP request body can contain sensitive information and may
// be a security/privacy risk to log.
RequestBody bool
// Controls if the HTTP response body is logged. The zero-value/default behavior
// is to not log the HTTP response body.
//
// Notice: The HTTP response body can contain sensitive information and may
// be a security/privacy risk to log.
ResponseBody bool
}
LoggerConfig controls the behavior of the logging middlewares.
type PrometheusConfig ¶
type PrometheusConfig struct {
// Allows the middleware to inspect the request and decide to skip the
// middleware.
Skipper middleware.Skipper
Namespace string
Subsystem string
LatencyBuckets []float64
SizeBuckets []float64
ConstLabels map[string]string
Registerer prometheus.Registerer
}
Click to show internal directories.
Click to hide internal directories.