From 74e5161a4cb581c770fa03bc2538dc7f2319bc2e Mon Sep 17 00:00:00 2001 From: enahum Date: Sun, 17 Apr 2016 21:32:20 -0300 Subject: [PATCH] PLT-2593: Fix logs being stored with user locale (#2722) --- api/context.go | 2 +- model/utils.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/api/context.go b/api/context.go index ddc8f79b15..56c8c86d26 100644 --- a/api/context.go +++ b/api/context.go @@ -267,7 +267,7 @@ func (c *Context) LogAuditWithUserId(userId, extraInfo string) { func (c *Context) LogError(err *model.AppError) { l4g.Error(utils.T("api.context.log.error"), c.Path, err.Where, err.StatusCode, - c.RequestId, c.Session.UserId, c.IpAddress, err.Message, err.DetailedError) + c.RequestId, c.Session.UserId, c.IpAddress, err.SystemMessage(utils.T), err.DetailedError) } func (c *Context) UserRequired() { diff --git a/model/utils.go b/model/utils.go index 1ce41bb303..bb02f345d7 100644 --- a/model/utils.go +++ b/model/utils.go @@ -50,6 +50,14 @@ func (er *AppError) Translate(T goi18n.TranslateFunc) { } } +func (er *AppError) SystemMessage(T goi18n.TranslateFunc) string { + if er.params == nil { + return T(er.Id) + } else { + return T(er.Id, er.params) + } +} + func (er *AppError) ToJson() string { b, err := json.Marshal(er) if err != nil {