[MM-31776] explicitly call level functions for mlog (#16648)
Automatic Merge
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e89b26e8f3
Коммит
cfc501f5a6
@@ -87,22 +87,21 @@ func (c *Context) LogAuditWithUserId(userId, extraInfo string) {
|
|||||||
|
|
||||||
func (c *Context) LogErrorByCode(err *model.AppError) {
|
func (c *Context) LogErrorByCode(err *model.AppError) {
|
||||||
code := err.StatusCode
|
code := err.StatusCode
|
||||||
var level mlog.LogLevel
|
msg := err.SystemMessage(utils.TDefault)
|
||||||
switch {
|
fields := []mlog.Field{
|
||||||
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),
|
|
||||||
mlog.String("err_where", err.Where),
|
mlog.String("err_where", err.Where),
|
||||||
mlog.Int("http_code", err.StatusCode),
|
mlog.Int("http_code", err.StatusCode),
|
||||||
mlog.String("err_details", err.DetailedError),
|
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 {
|
func (c *Context) IsSystemAdmin() bool {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user