skip http request logging when the client aborts the request (#3195)
* skip http request logging when the client aborts the request * cleanup
This commit is contained in:
@@ -31,7 +31,7 @@ func handleError(w http.ResponseWriter, r *http.Request, status int, err error,
|
|||||||
if r != nil && r.URL != nil {
|
if r != nil && r.URL != nil {
|
||||||
keysAndValues = append(keysAndValues, "method", r.Method, "path", r.URL.Path)
|
keysAndValues = append(keysAndValues, "method", r.Method, "path", r.URL.Path)
|
||||||
}
|
}
|
||||||
if !errors.Is(err, context.Canceled) {
|
if !errors.Is(err, context.Canceled) && !errors.Is(r.Context().Err(), context.Canceled) {
|
||||||
logger.GetLogger().WithCallDepth(1).Warnw("error handling request", err, keysAndValues...)
|
logger.GetLogger().WithCallDepth(1).Warnw("error handling request", err, keysAndValues...)
|
||||||
}
|
}
|
||||||
w.WriteHeader(status)
|
w.WriteHeader(status)
|
||||||
|
|||||||
Reference in New Issue
Block a user