Suppress /health request logging from localhost

This commit is contained in:
Helmut K. C. Tessarek 2023-05-24 12:03:12 -04:00 committed by GitHub
parent 62a1c99841
commit 8f51a2c72d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -176,6 +176,10 @@ func Create(db *database.GormDatabase, vInfo *model.VersionInfo, conf *config.Co
var tokenRegexp = regexp.MustCompile("token=[^&]+")
func logFormatter(param gin.LogFormatterParams) string {
if (param.ClientIP == "127.0.0.1" || param.ClientIP == "::1") && param.Path == "/health" {
return ""
}
var statusColor, methodColor, resetColor string
if param.IsOutputColor() {
statusColor = param.StatusCodeColor()