mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-04 00:10:25 +08:00
26 lines
349 B
Go
26 lines
349 B
Go
package middleware
|
|
|
|
import (
|
|
"mayfly-go/base/ctx"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
var logHandler = new(ctx.LogInfo)
|
|
|
|
func ReqLog() gin.HandlerFunc {
|
|
return func(c *gin.Context) {
|
|
|
|
// 处理请求
|
|
c.Next()
|
|
|
|
reqCtxI, exist := c.Get("reqCtx")
|
|
if !exist {
|
|
return
|
|
}
|
|
|
|
reqCtx := reqCtxI.(*ctx.ReqCtx)
|
|
logHandler.AfterHandle(reqCtx)
|
|
}
|
|
}
|