PLT-2593: Fix logs being stored with user locale (#2722)

This commit is contained in:
enahum
2016-04-17 21:32:20 -03:00
committed by Corey Hulen
parent c6c3f1e478
commit 74e5161a4c
2 changed files with 9 additions and 1 deletions

View File

@@ -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() {

View File

@@ -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 {