treewide: replace {e,}println!s with log macros

Currently, our logs are a bit inconsistent, with some being
`{e,}println!`s and others utilizing macros from the `log` crate. One
line might look like `INFO:ofborg::tasks::evaluate: Removing labels:
[]`, while the next might look like `Already: []`.
This commit is contained in:
Cole Helbling 2020-04-05 23:26:05 -07:00
parent 5c1a85ca31
commit 1b8cec63f2
No known key found for this signature in database
GPG key ID: B37E0F2371016A4C
8 changed files with 27 additions and 26 deletions

View file

@ -46,8 +46,8 @@ impl<'a> CommitStatus<'a> {
pub fn set(&self, state: hubcaps::statuses::State) -> Result<(), CommitStatusError> {
let desc = if self.description.len() >= 140 {
eprintln!(
"Warning: description is over 140 char; truncating: {:?}",
warn!(
"description is over 140 char; truncating: {:?}",
&self.description
);
self.description.chars().take(140).collect()

View file

@ -261,11 +261,11 @@ impl notifyworker::SimpleNotifyWorker for BuildWorker {
type J = buildjob::BuildJob;
fn msg_to_job(&self, _: &Deliver, _: &BasicProperties, body: &[u8]) -> Result<Self::J, String> {
println!("lmao I got a job?");
info!("lmao I got a job?");
match buildjob::from(body) {
Ok(e) => Ok(e),
Err(e) => {
println!("{:?}", String::from_utf8(body.to_vec()));
error!("{:?}", String::from_utf8(body.to_vec()));
panic!("{:?}", e);
}
}
@ -316,7 +316,7 @@ impl notifyworker::SimpleNotifyWorker for BuildWorker {
return;
}
println!(
info!(
"Got path: {:?}, determining which ones we can build ",
refpath
);
@ -332,7 +332,7 @@ impl notifyworker::SimpleNotifyWorker for BuildWorker {
.map(|(attr, _)| attr)
.collect();
println!(
info!(
"Can build: '{}', Cannot build: '{}'",
can_build.join(", "),
cannot_build_attrs.join(", ")
@ -372,17 +372,17 @@ impl notifyworker::SimpleNotifyWorker for BuildWorker {
},
};
println!("ok built ({:?}), building", status);
println!("Lines:\n-----8<-----");
info!("ok built ({:?}), building", status);
info!("Lines:\n-----8<-----");
actions
.log_snippet()
.iter()
.inspect(|x| println!("{}", x))
.inspect(|x| info!("{}", x))
.last();
println!("----->8-----");
info!("----->8-----");
actions.build_finished(status, can_build, cannot_build_attrs);
println!("Done!");
info!("Done!");
}
}

View file

@ -575,7 +575,7 @@ fn request_reviews(maint: &maintainers::ImpactedMaintainers, pull: &hubcaps::pul
team_reviewers: vec![],
})
{
println!("Failure requesting a review from {}: {:?}", maintainer, e,);
warn!("Failure requesting a review from {}: {:?}", maintainer, e,);
}
}
}

View file

@ -101,12 +101,12 @@ impl Stdenvs {
true,
);
println!("{:?}", result);
info!("{:?}", result);
match result {
Ok(mut out) => Some(file_to_str(&mut out)),
Err(mut out) => {
println!("{:?}", file_to_str(&mut out));
warn!("{:?}", file_to_str(&mut out));
None
}
}

View file

@ -163,8 +163,8 @@ impl<'a, E: stats::SysEvents + 'static> OneEval<'a, E> {
state: hubcaps::statuses::State,
) -> Result<(), hubcaps::Error> {
let description = if description.len() >= 140 {
eprintln!(
"Warning: description is over 140 char; truncating: {:?}",
warn!(
"description is over 140 char; truncating: {:?}",
&description
);
description.chars().take(140).collect()
@ -210,7 +210,7 @@ impl<'a, E: stats::SysEvents + 'static> OneEval<'a, E> {
match eval_result {
EvalWorkerError::CommitStatusWrite(e) => {
eprintln!(
error!(
"Failed to write commit status, got error: {:?}, marking internal error",
e
);
@ -218,7 +218,7 @@ impl<'a, E: stats::SysEvents + 'static> OneEval<'a, E> {
update_labels(&issue_ref, &[String::from("ofborg-internal-error")], &[]);
}
EvalWorkerError::EvalError(eval::Error::CommitStatusWrite(e)) => {
eprintln!(
error!(
"Failed to write commit status, got error: {:?}, marking internal error",
e
);
@ -379,7 +379,7 @@ impl<'a, E: stats::SysEvents + 'static> OneEval<'a, E> {
evaluation_strategy.after_merge(&mut overall_status)?;
println!("Got path: {:?}, building", refpath);
info!("Got path: {:?}, building", refpath);
overall_status
.set_with_description("Beginning Evaluations", hubcaps::statuses::State::Pending)?;
@ -532,7 +532,8 @@ pub fn update_labels(issue: &hubcaps::issues::IssueRef, add: &[String], remove:
.iter()
.map(|l| l.name.clone())
.collect();
println!("Already: {:?}", existing);
info!("Already: {:?}", existing);
let to_add = add
.iter()
.filter(|l| !existing.contains(l)) // Remove labels already on the issue

View file

@ -30,7 +30,7 @@ impl worker::SimpleWorker for GitHubCommentWorker {
match serde_json::from_slice(body) {
Ok(e) => Ok(e),
Err(e) => {
println!(
error!(
"Failed to deserialize IsssueComment: {:?}",
String::from_utf8(body.to_vec())
);
@ -55,15 +55,15 @@ impl worker::SimpleWorker for GitHubCommentWorker {
);
if build_destinations.is_empty() {
println!("No build destinations for: {:?}", job);
info!("No build destinations for: {:?}", job);
// Don't process comments if they can't build anything
return vec![worker::Action::Ack];
}
println!("Got job: {:?}", job);
info!("Got job: {:?}", job);
let instructions = commentparser::parse(&job.comment.body);
println!("Instructions: {:?}", instructions);
info!("Instructions: {:?}", instructions);
let pr = self
.github

View file

@ -70,7 +70,7 @@ impl worker::SimpleWorker for GitHubCommentPoster {
}
for check in checks {
println!(":{:?}", check);
info!(":{:?}", check);
let check_create_attempt = self
.github_vend

View file

@ -44,7 +44,7 @@ fn validate_path_segment(segment: &PathBuf) -> Result<(), String> {
if segment.components().all(|component| match component {
Component::Normal(_) => true,
e => {
println!("Invalid path component: {:?}", e);
warn!("Invalid path component: {:?}", e);
false
}
}) {