Example #1
0
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)
	}
	log.SetSeverity(s)
	return scroll.Response{"message": fmt.Sprintf("Severity has been updated to %v", s)}, nil
}
Example #2
0
// Set is part of the flag.Value interface.
func (s *SeverityFlag) Set(value string) error {
	out, err := log.SeverityFromString(value)
	if err != nil {
		return err
	}
	s.S = out
	return nil
}
Example #3
0
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)
}
Example #4
0
func (cmd *Command) updateLogSeverityAction(c *cli.Context) {
	sev, err := log.SeverityFromString(c.String("severity"))
	if err != nil {
		cmd.printError(err)
		return
	}
	if err := cmd.client.UpdateLogSeverity(sev); err != nil {
		cmd.printError(err)
		return
	}
	cmd.printOk("log severity updated")
}