Skip to content

Commit

Permalink
refactor: standardize and clarify logs
Browse files Browse the repository at this point in the history
In particular, make it easier to troubleshoot feeds which have entries
that are skipped. This patch makes it more easy to go view the feed
itself directly, and find the item that is causing an issue.
  • Loading branch information
lukehsiao committed Sep 7, 2023
1 parent 9e8a2d6 commit 1403d0c
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ fn get_feeds_from_urls(urls: Vec<Url>) -> Result<Vec<(Feed, Url)>> {
let body = match agent.get(url.as_str()).call() {
Ok(r) => r.into_string().ok(),
Err(e) => {
warn!(url=%url.as_str(), error=%e, "Failed to get feed");
warn!(url=%url.as_str(), error=%e, "failed to get feed.");
None
}
};
Expand All @@ -187,7 +187,7 @@ fn get_feeds_from_urls(urls: Vec<Url>) -> Result<Vec<(Feed, Url)>> {
warn!(
url=%url.as_str(),
error=%e,
"Failed to parse RSS/Atom feed."
"failed to parse feed."
);
pb.finish_with_message(format!(
"Failed to parse feed from `{}`",
Expand Down Expand Up @@ -306,7 +306,7 @@ pub fn run(args: Args) -> Result<()> {
warn!(
?link,
?source_link,
"Skipping link from feed: no summary or content provided."
"skipping link from feed: no summary or content provided."
);
continue;
}
Expand All @@ -315,7 +315,7 @@ pub fn run(args: Args) -> Result<()> {
warn!(
?link,
?source_link,
"Skipping link from feed: no summary or content provided."
"skipping link from feed: no summary or content provided."
);
continue;
}
Expand All @@ -337,11 +337,12 @@ pub fn run(args: Args) -> Result<()> {
});
} else {
warn!(
link=?entry.links,
title=?entry.title,
published=?entry.published,
updated=?entry.updated,
"Skipping. Must have link, title, and a date."
entry_links=?entry.links,
entry_title=?entry.title,
entry_published=?entry.published,
entry_updated=?entry.updated,
source=url.as_str(),
"skipping entry: must have link, title, and a date."
);
}
}
Expand Down

0 comments on commit 1403d0c

Please sign in to comment.