[MM-31512] Downgrade 4xx and 501 errors to info/debug level (#16585)

* Downgrade 4xx and 501 errors to info/debug level

* use switch instead
Этот коммит содержится в:
Ibrahim Serdar Acikgoz
2020-12-23 13:08:35 +03:00
коммит произвёл GitHub
родитель 6487d0ca91
Коммит 8ca880d1cc

Просмотреть файл

@@ -268,7 +268,15 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if c.Err.Id == "api.context.session_expired.app_error" {
c.LogInfo(c.Err)
} else {
c.LogError(c.Err)
code := c.Err.StatusCode
switch {
case code >= http.StatusBadRequest && code < http.StatusInternalServerError:
c.LogDebug(c.Err)
case code == http.StatusNotImplemented:
c.LogInfo(c.Err)
default:
c.LogError(c.Err)
}
}
c.Err.Where = r.URL.Path