Skip to content

Commit

Permalink
fix: 开启仅记录错误时,记录第一个错误后就一直记录所有信息的BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
zodial committed May 14, 2024
1 parent 8136c3b commit 54678cb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ func Telescope() gin.HandlerFunc {
}
if errorRecord && hasError {
log.WithContext(ctx).WithFields(log.Fields{"type": "request"}).Error(ctx.Request.URL)
defer func() {
hasError = false
}()
} else {
log.WithContext(ctx).WithFields(log.Fields{"type": "request"}).Debug(ctx.Request.URL)
}
Expand Down

0 comments on commit 54678cb

Please sign in to comment.