[MM-31776] explicitly call level functions for mlog (#16648)

Automatic Merge
Этот коммит содержится в:
Ibrahim Serdar Acikgoz
2021-01-08 23:15:17 +03:00
коммит произвёл GitHub
родитель e89b26e8f3
Коммит cfc501f5a6

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

@@ -87,22 +87,21 @@ func (c *Context) LogAuditWithUserId(userId, extraInfo string) {
func (c *Context) LogErrorByCode(err *model.AppError) {
code := err.StatusCode
var level mlog.LogLevel
switch {
case (code >= http.StatusBadRequest && code < http.StatusInternalServerError) ||
err.Id == "web.check_browser_compatibility.app_error":
level = mlog.LvlDebug
case code == http.StatusNotImplemented:
level = mlog.LvlInfo
default:
level = mlog.LvlError
}
c.Logger.Log(level,
err.SystemMessage(utils.TDefault),
msg := err.SystemMessage(utils.TDefault)
fields := []mlog.Field{
mlog.String("err_where", err.Where),
mlog.Int("http_code", err.StatusCode),
mlog.String("err_details", err.DetailedError),
)
}
switch {
case (code >= http.StatusBadRequest && code < http.StatusInternalServerError) ||
err.Id == "web.check_browser_compatibility.app_error":
c.Logger.Debug(msg, fields...)
case code == http.StatusNotImplemented:
c.Logger.Info(msg, fields...)
default:
c.Logger.Error(msg, fields...)
}
}
func (c *Context) IsSystemAdmin() bool {