Skip to content

Commit

Permalink
feat: improve session result logging (#1123)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
piksel committed Nov 18, 2021
1 parent d9d6f79 commit 782529d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion pkg/notifications/shoutrrr.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}()
Expand Down

0 comments on commit 782529d

Please sign in to comment.