Back to godoc.org

Package middleware

v2.2.0
Latest Go to latest

The latest major version is v2.

Published: Apr 14, 2020 | License: MIT | Module: github.com/gozix/echo/v2

Overview

Package middleware provide implementations of custom middleware for the echo framework.

Package middleware provide implementations of custom middleware for the echo framework.

Index

Variables

var DefaultZapConfig = ZapConfig{
	Fields: []string{
		"id", "remote_ip", "host", "method", "uri", "user_agent", "status",
		"error", "latency", "latency_human", "bytes_in", "bytes_out",
	},
}

DefaultZapConfig is the default Zap middleware config.

func ErrTransWithConfig

func ErrTransWithConfig(conf ErrTransConfig) echo.MiddlewareFunc

ErrTransWithConfig returns echo.MiddlewareFunc.

func ZapWithConfig

func ZapWithConfig(cfg ZapConfig) echo.MiddlewareFunc

ZapWithConfig returns echo.MiddlewareFunc.

type ErrTransConfig

type ErrTransConfig struct {
	Skipper    middleware.Skipper
	Translator *ut.UniversalTranslator
}

ErrTransConfig defines the config for ErrTransWithConfig middleware.

type ZapConfig

type ZapConfig struct {
	// Logged fields.
	//
	// - id (Request ID)
	// - remote_ip
	// - host
	// - method
	// - uri
	// - 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>
	//
	// Optional. Default value DefaultZapConfig.Fields.
	Fields []string

	// Skipper defines a function to skip middleware.
	Logger *zap.Logger

	// Skipper defines a function to skip middleware.
	Skipper middleware.Skipper
}

ZapConfig defines the config for AccessWithConfig middleware.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier