mirror of
https://github.com/mattermost/mattermost.git
synced 2026-05-28 04:35:04 -04:00
[MM-24856] User request specific loggers in channels/api4/system.go (#24881)
* replace global mlog with local c.Logger and setInvalidParam with setInvalidParamWithErr if relevant Signed-off-by: Deepayan Mukherjee <deepayanmukherjee1312@gmail.com> * replace global mlog.Info with local c.Logger.Info Signed-off-by: Deepayan Mukherjee <deepayanmukherjee1312@gmail.com> --------- Signed-off-by: Deepayan Mukherjee <deepayanmukherjee1312@gmail.com>
This commit is contained in:
parent
13c05a571f
commit
77ee4d93b7
1 changed files with 9 additions and 9 deletions
|
|
@ -146,7 +146,7 @@ func getSystemPing(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
actualGoroutines := runtime.NumGoroutine()
|
||||
if *c.App.Config().ServiceSettings.GoroutineHealthThreshold > 0 && actualGoroutines >= *c.App.Config().ServiceSettings.GoroutineHealthThreshold {
|
||||
mlog.Warn("The number of running goroutines is over the health threshold", mlog.Int("goroutines", actualGoroutines), mlog.Int("health_threshold", *c.App.Config().ServiceSettings.GoroutineHealthThreshold))
|
||||
c.Logger.Warn("The number of running goroutines is over the health threshold", mlog.Int("goroutines", actualGoroutines), mlog.Int("health_threshold", *c.App.Config().ServiceSettings.GoroutineHealthThreshold))
|
||||
s[model.STATUS] = model.StatusUnhealthy
|
||||
}
|
||||
|
||||
|
|
@ -159,14 +159,14 @@ func getSystemPing(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
writeErr := c.App.DBHealthCheckWrite()
|
||||
if writeErr != nil {
|
||||
mlog.Warn("Unable to write to database.", mlog.Err(writeErr))
|
||||
c.Logger.Warn("Unable to write to database.", mlog.Err(writeErr))
|
||||
s[dbStatusKey] = model.StatusUnhealthy
|
||||
s[model.STATUS] = model.StatusUnhealthy
|
||||
}
|
||||
|
||||
writeErr = c.App.DBHealthCheckDelete()
|
||||
if writeErr != nil {
|
||||
mlog.Warn("Unable to remove ping health check value from database.", mlog.Err(writeErr))
|
||||
c.Logger.Warn("Unable to remove ping health check value from database.", mlog.Err(writeErr))
|
||||
s[dbStatusKey] = model.StatusUnhealthy
|
||||
s[model.STATUS] = model.StatusUnhealthy
|
||||
}
|
||||
|
|
@ -366,7 +366,7 @@ func queryLogs(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||
if err2 == nil {
|
||||
logsJSON[node] = append(logsJSON[node], result)
|
||||
} else {
|
||||
mlog.Warn("Error parsing log line in Server Logs")
|
||||
c.Logger.Warn("Error parsing log line in Server Logs")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -703,7 +703,7 @@ func setServerBusy(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||
audit.AddEventParameter(auditRec, "seconds", i)
|
||||
|
||||
c.App.Srv().Platform().Busy.Set(time.Second * time.Duration(i))
|
||||
mlog.Warn("server busy state activated - non-critical services disabled", mlog.Int64("seconds", i))
|
||||
c.Logger.Warn("server busy state activated - non-critical services disabled", mlog.Int64("seconds", i))
|
||||
|
||||
auditRec.Success()
|
||||
ReturnStatusOK(w)
|
||||
|
|
@ -719,7 +719,7 @@ func clearServerBusy(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||
defer c.LogAuditRec(auditRec)
|
||||
|
||||
c.App.Srv().Platform().Busy.Clear()
|
||||
mlog.Info("server busy state cleared - non-critical services enabled")
|
||||
c.Logger.Info("server busy state cleared - non-critical services enabled")
|
||||
|
||||
auditRec.Success()
|
||||
ReturnStatusOK(w)
|
||||
|
|
@ -735,11 +735,11 @@ func getServerBusyExpires(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||
// along with doing some computations.
|
||||
sbsJSON, jsonErr := c.App.Srv().Platform().Busy.ToJSON()
|
||||
if jsonErr != nil {
|
||||
mlog.Warn(jsonErr.Error())
|
||||
c.Logger.Warn(jsonErr.Error())
|
||||
}
|
||||
|
||||
if _, err := w.Write(sbsJSON); err != nil {
|
||||
mlog.Warn("Error while writing response", mlog.Err(err))
|
||||
c.Logger.Warn("Error while writing response", mlog.Err(err))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -947,7 +947,7 @@ func getProductNotices(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
client, parseError := model.NoticeClientTypeFromString(r.URL.Query().Get("client"))
|
||||
if parseError != nil {
|
||||
c.SetInvalidParam("client")
|
||||
c.SetInvalidParamWithErr("client", parseError)
|
||||
return
|
||||
}
|
||||
clientVersion := r.URL.Query().Get("clientVersion")
|
||||
|
|
|
|||
Loading…
Reference in a new issue