middleware

package
v0.0.0-...-946fd12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultZapLoggerConfig is the default ZapLogger middleware config.
	DefaultZapLoggerConfig = ZapLoggerConfig{
		Skipper: DefaultSkipper,
	}
)

Functions

func Auth

func Auth(a AuthService) echo.MiddlewareFunc

func DefaultSkipper

func DefaultSkipper(echo.Context) bool

DefaultSkipper returns false which processes the middleware

func ZapLogger

func ZapLogger(log *zap.Logger) echo.MiddlewareFunc

ZapLogger is a middleware and zap to provide an "access log" like logging for each request.

func ZapLoggerWithConfig

func ZapLoggerWithConfig(log *zap.Logger, config ZapLoggerConfig) echo.MiddlewareFunc

ZapLoggerWithConfig is a middleware (with configuration) and zap to provide an "access log" like logging for each request.

Types

type AuthService

type AuthService interface {
	Validate(ctx context.Context, token string) (auth.Token, error)
}

type Skipper

type Skipper func(c echo.Context) bool

type ZapLoggerConfig

type ZapLoggerConfig struct {
	// Skipper defines a function to skip middleware
	Skipper Skipper
}

ZapLoggerConfig defines the config for ZapLogger middleware

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL