convert repeated error checks into single function in logger (#15387)

This commit is contained in:
jiuker
2022-07-26 08:53:03 +08:00
committed by GitHub
parent 426c902b87
commit 6b4f833a12
3 changed files with 11 additions and 34 deletions

View File

@@ -18,7 +18,10 @@
package logger
import (
"context"
"errors"
"fmt"
"net/http"
"regexp"
"runtime"
@@ -59,3 +62,8 @@ func ansiRestoreAttributes() {
ansiEscape("8")
}
}
// logIgnoreError if true,the error will ignore.
func logIgnoreError(err error) bool {
return err == nil || errors.Is(err, context.Canceled) || errors.Is(err, http.ErrServerClosed) || err.Error() == "disk not found"
}