diff --git a/src/extra_fields.rs b/src/extra_fields.rs index 7525539..cb37521 100644 --- a/src/extra_fields.rs +++ b/src/extra_fields.rs @@ -198,7 +198,7 @@ fn extract_field(field_name: Field, extra: &Value, fields: &[String], id: Id, tr // If we at least got an existing but empty field, return an empty string. // I think it's safe to treat it as such. } else { - log::warn!("Fields are empty in {}: {:?}", id, empty_fields); + log::warn!("Fields are empty in {} ({}): {:?}", id, id.url(tracker), empty_fields); Ok(String::new()) } } @@ -546,7 +546,7 @@ impl ExtraFields for Issue { if !errors.is_empty() { let id = Id::Jira(&self.key); let report = error_chain(errors, Field::TargetRelease, fields, id, config); - log::warn!("The custom target releases failed in {}. Falling back on the standard fix versions field.", id); + log::warn!("The custom target releases failed in {} ({}). Falling back on the standard fix versions field.", id, id.url(config)); // Provide this additional information on demand. log::debug!("{}", report); diff --git a/src/lib.rs b/src/lib.rs index f92f7e4..b142a01 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -181,7 +181,7 @@ impl Document { project.private_footnote, ); - templating::report_usage_statistics(&internal_stats); + templating::report_usage_statistics(&internal_stats, &tickets_for_internal); let used_internal: Vec<&AbstractTicket> = tickets_for_internal .into_iter() diff --git a/src/templating.rs b/src/templating.rs index 7ee526e..07208b8 100644 --- a/src/templating.rs +++ b/src/templating.rs @@ -335,7 +335,7 @@ impl config::Section { // If subsystems resulted in an error, print out some debugging information // before quitting. The ticket ID is especially useful. Err(e) => { - log::error!("Invalid subsystems field in ticket {}.", &ticket.id); + log::error!("Invalid subsystems field in ticket {} ({}).", &ticket.id, &ticket.url); panic!("{}", e); } }; @@ -413,17 +413,31 @@ pub fn format_document( /// Log statistics about tickets that haven't been used anywhere in the templates, /// or have been used more than once. Log both as warnings. -pub fn report_usage_statistics(ticket_stats: &HashMap, u32>) { +pub fn report_usage_statistics( + ticket_stats: &HashMap, u32>, + tickets: &[&AbstractTicket], +) { + let url_map: HashMap<&Rc, &str> = tickets + .iter() + .map(|t| (&t.id, t.url.as_str())) + .collect(); + let unused: Vec = ticket_stats .iter() .filter(|&(_k, &v)| v == 0) - .map(|(k, _v)| Rc::clone(k).to_string()) + .map(|(k, _v)| { + let url = url_map.get(k).copied().unwrap_or("unknown"); + format!("{} ({})", k, url) + }) .collect(); let overused: Vec = ticket_stats .iter() .filter(|&(_k, &v)| v > 1) - .map(|(k, _v)| Rc::clone(k).to_string()) + .map(|(k, _v)| { + let url = url_map.get(k).copied().unwrap_or("unknown"); + format!("{} ({})", k, url) + }) .collect(); if !unused.is_empty() {