middlewares

package
v1.3.2-0...-4312943 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodTag = "golinks.middlewares.logger.method"
	URLTag    = "golinks.middlewares.logger.url"
)

Key defines the key for logger to save in gin.Context.

Variables

View Source
var (
	ErrNotFound = errors.New("not found")
	ErrInternal = errors.New("internal")
)

Exported errors.

Functions

func CtxLogger

func CtxLogger(ctx *gin.Context)

CtxLogger logs the request context

func GetLogger

func GetLogger(c *gin.Context) log.Logger

GetLogger gets logger from gin context and returns log.Null() as the default value.

func Limited

func Limited(
	keyFunc func(*gin.Context) (string, error),
	limit limiter.Limiter) gin.HandlerFunc

Limited returns a middleware that limits the access of clients with keyFunc and limiter.

func PanicCatcher

func PanicCatcher(ctx *gin.Context)

PanicCatcher defines a panic catcher handler.

func Trace

func Trace(ctx *gin.Context)

Trace requests with opencesnsus.

Types

This section is empty.

Jump to

Keyboard shortcuts

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