Fix post notification logging
@@ -103,6 +103,8 @@ type PreparedHttp struct {
Method string
Headers map[string]string `json:",omitempty"`
Body string
+ AK string
+ NotifyName string
}
func (p *PreparedHttp) Send() (int, error) {
@@ -127,7 +129,7 @@ func (p *PreparedHttp) Send() (int, error) {
return 0, err
}
if resp.StatusCode >= 300 {
- return resp.StatusCode, fmt.Errorf("bad response on notification %s: %d", p.Method, resp.StatusCode)
+ return resp.StatusCode, fmt.Errorf("bad response on notification with name %s for alert %s method %s: %d", p.NotifyName, p.AK, p.Method, resp.StatusCode)
}
return resp.StatusCode, nil
}
@@ -137,6 +139,8 @@ func (n *Notification) PrepHttp(method string, url string, body string, ak strin
Method: method,
URL: url,
Headers: map[string]string{},
+ AK: ak,
+ NotifyName: n.Name,
}
if method == http.MethodPost {
prep.Body = body
