From 2af8122753691dcda7836ffd8013681d47a07ff6 Mon Sep 17 00:00:00 2001 From: ChaoticByte Date: Fri, 13 Oct 2023 21:05:01 +0200 Subject: [PATCH] Fixed and improved logging of sent mail notifications --- main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index c8df8e0..b9db59a 100644 --- a/main.go +++ b/main.go @@ -79,15 +79,17 @@ func main() { } } if len(newNotices) > 0 { + fmt.Printf("INFO\t%v Sending email notifications ...\n", time.Now().Format(time.RFC3339Nano)) + recipientsNotified := 0 for _, r := range config.Recipients { - fmt.Printf("INFO\t%v Sending email notifications ...\n", time.Now().Format(time.RFC3339Nano)) err := r.filterAndSendNotices(newNotices, mailTemplate, mailAuth, config.SmtpConfiguration) if err != nil { fmt.Printf("ERROR\t%v\n", err) } else { - fmt.Printf("INFO\t%v Email notifications sent.\n", time.Now().Format(time.RFC3339Nano)) + recipientsNotified++ } } + fmt.Printf("INFO\t%v Email notifications sent to %v of %v recipients.\n", time.Now().Format(time.RFC3339Nano), recipientsNotified, len(config.Recipients)) } t2 := time.Now().UnixMilli() dt := int(t2 - t1)