Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultLogger ¶ added in v0.17.4
func DefaultLogger() gin.HandlerFunc
func JwtAuth ¶ added in v0.17.4
func JwtAuth() gin.HandlerFunc
Types ¶
type LogLayout ¶ added in v0.17.4
type LogLayout struct { Time time.Time Metadata map[string]interface{} // 存储自定义原数据 Path string // 访问路径 Query string // 携带query Body string // 携带body数据 IP string // ip地址 UserAgent string // 代理ua Error string // 错误 Cost time.Duration // 花费时间 Source string // 来源 }
LogLayout 日志layout
type Logger ¶ added in v0.17.4
type Logger struct { // Filter 用户自定义过滤 Filter func(c *gin.Context) bool // FilterKeyword 关键字过滤(key) FilterKeyword func(layout *LogLayout) bool // AuthProcess 鉴权处理 AuthProcess func(c *gin.Context, layout *LogLayout) // 日志处理 Print func(LogLayout) // Source 服务唯一标识 Source string }
func (Logger) SetLoggerMiddleware ¶ added in v0.17.4
func (l Logger) SetLoggerMiddleware() gin.HandlerFunc
Click to show internal directories.
Click to hide internal directories.