mirror of
https://github.com/lejianwen/rustdesk-api.git
synced 2025-12-03 18:43:15 +00:00
first
This commit is contained in:
20
http/middleware/logger.go
Normal file
20
http/middleware/logger.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"Gwen/global"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// Logger 日志中间件
|
||||
func Logger() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
global.Logger.WithFields(
|
||||
logrus.Fields{
|
||||
"uri": c.Request.URL,
|
||||
"ip": c.ClientIP(),
|
||||
"method": c.Request.Method,
|
||||
}).Debug("Request")
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user