middleware

package
v1.0.78 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessLog

func AccessLog(conf AccessLoggerConfig) gin.HandlerFunc

func PromMiddleware

func PromMiddleware(appName string) gin.HandlerFunc

func Recovery

func Recovery(handle gin.RecoveryFunc) gin.HandlerFunc

func RegistryMetrics

func RegistryMetrics(engine *gin.Engine, appName string)

Types

type AccessLoggerConfig

type AccessLoggerConfig struct {
	SkipPaths  []string `yaml:"skipPaths"`
	SkipCookie bool     `yaml:"skipCookie"`
	// request body 最大长度展示,0表示采用默认的10240,-1表示不打印
	MaxReqBodyLen int `yaml:"maxReqBodyLen"`
	// response body 最大长度展示,0表示采用默认的10240,-1表示不打印。指定长度的时候需注意,返回的json可能被截断
	MaxRespBodyLen int `yaml:"maxRespBodyLen"`
	// 自定义Skip功能
	Skip func(ctx *gin.Context) bool
}

access日志打印

Jump to

Keyboard shortcuts

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