From 9ab7ff204430b125db3b6ca368af104d20e793ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Sat, 20 Jun 2020 20:17:27 +0200 Subject: Fix/add debug messages --- internal/feed/cache_v1.go | 4 +++- internal/feed/state.go | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/feed/cache_v1.go b/internal/feed/cache_v1.go index 157741f..02890e1 100644 --- a/internal/feed/cache_v1.go +++ b/internal/feed/cache_v1.go @@ -2,6 +2,7 @@ package feed import ( "crypto/sha256" + "encoding/base64" "encoding/hex" "fmt" "strconv" @@ -207,6 +208,7 @@ func (cf *cachedFeed) filterItems(items []item, ignoreHash, alwaysNew bool) []it prevId := cf.Items[*oldIdx].ID ci.ID = prevId item.itemId = prevId + log.Debugf("oldIdx: %d, prevId: %s, item.id: %s", *oldIdx, prevId, item.id()) cf.deleteItem(*oldIdx) } filtered = append(filtered, *item) @@ -225,7 +227,7 @@ CACHE_ITEMS: item.addReason("guid (upd)") app(item, ci, &idx) } else { - log.Debugf("Similar, ignoring") + log.Debugf("Similar, ignoring item %s", base64.RawURLEncoding.EncodeToString(oldItem.ID[:])) } continue CACHE_ITEMS diff --git a/internal/feed/state.go b/internal/feed/state.go index 3828e37..5831ff4 100644 --- a/internal/feed/state.go +++ b/internal/feed/state.go @@ -103,9 +103,12 @@ func (feed *Feed) filterItems() []item { } if res { + if log.IsDebug() { + log.Debugf("Filter '%s' matches for item %s", feed.ItemFilter, printItem(item.Item)) + } items = append(items, item) } else if log.IsDebug() { // printItem is not for free - log.Debugf("Filter '%s' matches for item %s, removing.", feed.ItemFilter, printItem(item.Item)) + log.Debugf("Filter '%s' does not match for item %s", feed.ItemFilter, printItem(item.Item)) } } return items -- cgit v1.2.3