Skip to content

Commit 37a934d

Browse files
committed
feat: enhance webhook delivery logging with success and failure details
1 parent d78758c commit 37a934d

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

backend/webhooks.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,12 +843,14 @@ func (p *webhookPlugin) deliver(sc *scanner, eventType string, payload map[strin
843843
}
844844
if err != nil {
845845
d.Error = err.Error()
846+
p.log.Warn(fmt.Sprintf("webhook: delivery failed: webhook_id=%s event=%s url=%s error=%s", webhookID, eventType, targetURL, err.Error()))
846847
} else {
847848
d.StatusCode = resp.Status
848849
d.Success = resp.Status >= 200 && resp.Status < 300
849850
if !d.Success {
850851
d.Error = fmt.Sprintf("unexpected status %d", resp.Status)
851852
}
853+
p.log.Info(fmt.Sprintf("webhook: delivery attempt: webhook_id=%s event=%s url=%s status=%d success=%t", webhookID, eventType, targetURL, resp.Status, d.Success))
852854
}
853855

854856
inserted, insErr := p.db.Query(

0 commit comments

Comments
 (0)