summaryrefslogtreecommitdiffstats
path: root/app/security_update_check.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2018-04-27 12:49:45 -0700
committerGitHub <noreply@github.com>2018-04-27 12:49:45 -0700
commit686c2fbab7607d42183ae685a27ea3d7dce8c3f6 (patch)
tree53ed73cada57bc43f342ac10e2f842cddb095218 /app/security_update_check.go
parent2acbc77d78456d7ba76ceb687b18985d7d92f814 (diff)
downloadchat-686c2fbab7607d42183ae685a27ea3d7dce8c3f6.tar.gz
chat-686c2fbab7607d42183ae685a27ea3d7dce8c3f6.tar.bz2
chat-686c2fbab7607d42183ae685a27ea3d7dce8c3f6.zip
Structured logging (#8673)
* Implementing structured logging * Changes to en.json to allow refactor to run. * Fixing global logger * Structured logger initalization. * Add caller. * Do some log redirection. * Auto refactor * Cleaning up l4g reference and removing dependancy. * Removing junk. * Copyright headers. * Fixing tests * Revert "Changes to en.json to allow refactor to run." This reverts commit fd8249e99bcad0231e6ea65cd77c32aae9a54026. * Fixing some auto refactor strangeness and typo. * Making keys more human readable.
Diffstat (limited to 'app/security_update_check.go')
-rw-r--r--app/security_update_check.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/app/security_update_check.go b/app/security_update_check.go
index 1f1759fef..15bb81e5a 100644
--- a/app/security_update_check.go
+++ b/app/security_update_check.go
@@ -4,13 +4,14 @@
package app
import (
+ "fmt"
"io/ioutil"
"net/http"
"net/url"
"runtime"
"strconv"
- l4g "github.com/alecthomas/log4go"
+ "github.com/mattermost/mattermost-server/mlog"
"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/utils"
)
@@ -38,7 +39,7 @@ func (a *App) DoSecurityUpdateCheck() {
currentTime := model.GetMillis()
if (currentTime - lastSecurityTime) > SECURITY_UPDATE_PERIOD {
- l4g.Debug(utils.T("mattermost.security_checks.debug"))
+ mlog.Debug("Checking for security update from Mattermost")
v := url.Values{}
@@ -75,7 +76,7 @@ func (a *App) DoSecurityUpdateCheck() {
res, err := http.Get(SECURITY_URL + "/security?" + v.Encode())
if err != nil {
- l4g.Error(utils.T("mattermost.security_info.error"))
+ mlog.Error("Failed to get security update information from Mattermost.")
return
}
@@ -86,26 +87,26 @@ func (a *App) DoSecurityUpdateCheck() {
if bulletin.AppliesToVersion == model.CurrentVersion {
if props["SecurityBulletin_"+bulletin.Id] == "" {
if results := <-a.Srv.Store.User().GetSystemAdminProfiles(); results.Err != nil {
- l4g.Error(utils.T("mattermost.system_admins.error"))
+ mlog.Error("Failed to get system admins for security update information from Mattermost.")
return
} else {
users := results.Data.(map[string]*model.User)
resBody, err := http.Get(SECURITY_URL + "/bulletins/" + bulletin.Id)
if err != nil {
- l4g.Error(utils.T("mattermost.security_bulletin.error"))
+ mlog.Error("Failed to get security bulletin details")
return
}
body, err := ioutil.ReadAll(resBody.Body)
res.Body.Close()
if err != nil || resBody.StatusCode != 200 {
- l4g.Error(utils.T("mattermost.security_bulletin_read.error"))
+ mlog.Error("Failed to read security bulletin details")
return
}
for _, user := range users {
- l4g.Info(utils.T("mattermost.send_bulletin.info"), bulletin.Id, user.Email)
+ mlog.Info(fmt.Sprintf("Sending security bulletin for %v to %v", bulletin.Id, user.Email))
a.SendMail(user.Email, utils.T("mattermost.bulletin.subject"), string(body))
}
}