func (c *ProxyController) updateLogSeverity(w http.ResponseWriter, r *http.Request, params map[string]string) (interface{}, error) { s, err := log.SeverityFromString(r.Form.Get("severity")) if err != nil { return nil, formatError(err) } c.ng.SetLogSeverity(s) return scroll.Response{"message": fmt.Sprintf("Severity has been updated to %v", s)}, nil }
func (c *Client) GetLogSeverity() (log.Severity, error) { data, err := c.Get(c.endpoint("log", "severity"), url.Values{}) if err != nil { return -1, err } var sev *SeverityResponse if err := json.Unmarshal(data, &sev); err != nil { return -1, err } return log.SeverityFromString(sev.Severity) }