Skip to content

Commit

Permalink
feat: Log when a notification is sent
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Nov 16, 2024
1 parent b8229c5 commit 47034ca
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/integration/integrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,16 @@ func Setup(ctx context.Context, conf *config.Config) (Integrations, error) {
}

func (i Integrations) Send(ctx context.Context, message string) {
sent := make([]string, 0, len(i))
for _, integration := range i {
if err := integration.Send(ctx, message); err != nil {
slog.Error("Failed to send message", "integration", integration.Name(), "error", err)
slog.Error("Failed to notify", "integration", integration.Name(), "error", err)
continue
}
sent = append(sent, integration.Name())
}
if len(sent) != 0 {
slices.Sort(sent)
slog.Info("Sent notification", "integrations", sent)
}
}

0 comments on commit 47034ca

Please sign in to comment.