diff options
author | Corey Hulen <corey@hulen.com> | 2016-06-29 04:16:20 -0800 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-06-29 08:16:20 -0400 |
commit | b63f61fe7d022bf1569993afbd9441ee7db2feca (patch) | |
tree | ae8cb0adf048d69adf400be62788a45c7030b746 /api/context.go | |
parent | 6c5a8be6bfe1d6b9d8f71a6b0dc4d8cf93a03aab (diff) | |
download | chat-b63f61fe7d022bf1569993afbd9441ee7db2feca.tar.gz chat-b63f61fe7d022bf1569993afbd9441ee7db2feca.tar.bz2 chat-b63f61fe7d022bf1569993afbd9441ee7db2feca.zip |
PLT-3440 (#3440)
Diffstat (limited to 'api/context.go')
-rw-r--r-- | api/context.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/api/context.go b/api/context.go index 798f4dc87..fd8a0da7e 100644 --- a/api/context.go +++ b/api/context.go @@ -283,6 +283,11 @@ func (c *Context) LogError(err *model.AppError) { c.RequestId, c.Session.UserId, c.IpAddress, err.SystemMessage(utils.T), err.DetailedError) } +func (c *Context) LogDebug(err *model.AppError) { + l4g.Debug(utils.T("api.context.log.error"), c.Path, err.Where, err.StatusCode, + c.RequestId, c.Session.UserId, c.IpAddress, err.SystemMessage(utils.T), err.DetailedError) +} + func (c *Context) UserRequired() { if len(c.Session.UserId) == 0 { c.Err = model.NewLocAppError("", "api.context.session_expired.app_error", nil, "UserRequired") @@ -481,7 +486,13 @@ func Handle404(w http.ResponseWriter, r *http.Request) { err := model.NewLocAppError("Handle404", "api.context.404.app_error", nil, "") err.Translate(utils.T) err.StatusCode = http.StatusNotFound - l4g.Error("%v: code=404 ip=%v", r.URL.Path, GetIpAddress(r)) + + // filter out old paths that are poluting the log file + if strings.Contains(r.URL.Path, "/api/v1/") { + l4g.Debug("%v: code=404 ip=%v", r.URL.Path, GetIpAddress(r)) + } else { + l4g.Error("%v: code=404 ip=%v", r.URL.Path, GetIpAddress(r)) + } if IsApiCall(r) { w.WriteHeader(err.StatusCode) |