diff --git a/server/channels/api4/system.go b/server/channels/api4/system.go index ffca1df59e1..18a78e5786c 100644 --- a/server/channels/api4/system.go +++ b/server/channels/api4/system.go @@ -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")