This commit is contained in:
lwl0608 2024-05-21 17:16:39 +08:00
parent ad7a42a0f5
commit edd86f2bb8
1 changed files with 7 additions and 1 deletions

View File

@ -90,7 +90,9 @@ func LoggerMiddleware(conf gin.LoggerConfig) gin.HandlerFunc {
if ok { if ok {
bodyStr = string(body.([]byte)) bodyStr = string(body.([]byte))
} }
logger.Info("%s params: %s", formatter(param), bodyStr) if _, ok := NoLogRoutesMap[param.Path]; !ok {
logger.Info("%s params: %s", formatter(param), bodyStr)
}
//logger.Info("%s response: %s", formatter(param), blw.body.String()) //logger.Info("%s response: %s", formatter(param), blw.body.String())
//logger.WithCtx(c.Request.Context()).Info("%s params: %s", formatter(param), bodyStr) //logger.WithCtx(c.Request.Context()).Info("%s params: %s", formatter(param), bodyStr)
@ -100,3 +102,7 @@ func LoggerMiddleware(conf gin.LoggerConfig) gin.HandlerFunc {
} }
} }
} }
var NoLogRoutesMap = map[string]bool{
"/healthcheck": true,
}