aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-06-20 20:17:27 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-06-20 20:23:52 +0200
commit9ab7ff204430b125db3b6ca368af104d20e793ed (patch)
treea75082d2d2104aefa6620c2ff95d40ee96767e8a
parentc2a14778510e7166eaeb7b8cb61eac798b96b467 (diff)
downloadfeed2imap-go-9ab7ff204430b125db3b6ca368af104d20e793ed.tar.gz
feed2imap-go-9ab7ff204430b125db3b6ca368af104d20e793ed.tar.bz2
feed2imap-go-9ab7ff204430b125db3b6ca368af104d20e793ed.zip
Fix/add debug messages
-rw-r--r--internal/feed/cache_v1.go4
-rw-r--r--internal/feed/state.go5
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