예제 #1
0
파일: api.go 프로젝트: albertrdixon/romulus
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
}
예제 #2
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)
}