Skip to content

Commit

Permalink
feat(rss): add debug logger
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Oct 15, 2020
1 parent 3fa7815 commit 88a7aba
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/plugin-rss/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export function apply(ctx: Context, config: Config = {}) {
} else {
feedMap[url] = new Set()
feeder.add({ url, refresh })
logger.debug('subscribe', url)
}
}

Expand All @@ -47,6 +48,7 @@ export function apply(ctx: Context, config: Config = {}) {
if (!feedMap[url].size) {
delete feedMap[url]
feeder.remove(url)
logger.debug('unsubscribe', url)
}
}

Expand All @@ -63,6 +65,7 @@ export function apply(ctx: Context, config: Config = {}) {
}

feeder.on('new-item', async (payload) => {
logger.debug('receive', payload)
const source = payload.meta.link.toLowerCase()
if (!feedMap[source]) return
const message = `${payload.meta.title} (${payload.author})\n${payload.title}`
Expand Down

0 comments on commit 88a7aba

Please sign in to comment.