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

View File

@ -91,7 +91,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)
}
if strings.Contains(param.Path, "is_there_a_new_version_available") { if strings.Contains(param.Path, "is_there_a_new_version_available") {
logger.Info("%s response: %s", formatter(param), blw.body.String()) logger.Info("%s response: %s", formatter(param), blw.body.String())
} }
@ -103,3 +105,7 @@ func LoggerMiddleware(conf gin.LoggerConfig) gin.HandlerFunc {
} }
} }
} }
var NoLogRoutesMap = map[string]bool{
"/healthcheck": true,
}