From 782529ddbd6dbf04934cfa1c0e94515c789c2b7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nils=20m=C3=A5s=C3=A9n?= Date: Thu, 18 Nov 2021 14:08:38 +0100 Subject: [PATCH] feat: improve session result logging (#1123) - logs the session result as an info level message without notification instead of debug - does not log that no notification was sent if there are no notifications enabled --- cmd/root.go | 7 +++++-- pkg/notifications/shoutrrr.go | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 47f7133..ff1cac3 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -364,7 +364,10 @@ func runUpdatesWithNotifications(filter t.Filter) *metrics.Metric { } notifier.SendNotification(result) metricResults := metrics.NewMetric(result) - log.Debugf("Session done: %v scanned, %v updated, %v failed", - metricResults.Scanned, metricResults.Updated, metricResults.Failed) + notifications.LocalLog.WithFields(log.Fields{ + "Scanned": metricResults.Scanned, + "Updated": metricResults.Updated, + "Failed": metricResults.Failed, + }).Info("Session done") return metricResults } diff --git a/pkg/notifications/shoutrrr.go b/pkg/notifications/shoutrrr.go index ac293fb..1611a04 100644 --- a/pkg/notifications/shoutrrr.go +++ b/pkg/notifications/shoutrrr.go @@ -152,7 +152,7 @@ func (n *shoutrrrTypeNotifier) sendEntries(entries []*log.Entry, report t.Report go func() { if err != nil { LocalLog.WithError(err).Fatal("Notification template error") - } else { + } else if len(n.Urls) > 1 { LocalLog.Info("Skipping notification due to empty message") } }()