bin/*: replace {e,}println!s with log macros

May as well be consistent.
This commit is contained in:
Cole Helbling 2020-04-05 23:29:14 -07:00
parent 1b8cec63f2
commit c9d4bb1fd8
No known key found for this signature in database
GPG key ID: B37E0F2371016A4C
9 changed files with 48 additions and 40 deletions

View file

@ -1,3 +1,4 @@
use log::{info, log};
use ofborg::commentparser;
use ofborg::config;
use ofborg::easyamqp;
@ -11,10 +12,10 @@ fn main() {
let cfg = config::load(env::args().nth(1).unwrap().as_ref());
ofborg::setup_log();
println!("Hello, world!");
info!("Hello, world!");
let mut session = easyamqp::session_from_config(&cfg.rabbitmq).unwrap();
println!("Connected to rabbitmq");
info!("Connected to rabbitmq");
let mut channel = session.open_channel(1).unwrap();
@ -56,7 +57,7 @@ fn main() {
}
channel.close(200, "Bye").unwrap();
println!("Closed the channel");
info!("Closed the channel");
session.close(200, "Good Bye");
println!("Closed the session... EOF");
info!("Closed the session... EOF");
}

View file

@ -1,5 +1,5 @@
use amqp::Basic;
use log::{log, warn};
use log::{info, log, warn};
use ofborg::checkout;
use ofborg::config;
use ofborg::easyamqp::{self, TypedWrappers};
@ -103,10 +103,10 @@ fn main() {
)
.unwrap();
println!("Fetching jobs from {}", &queue_name);
info!("Fetching jobs from {}", &queue_name);
channel.start_consuming();
channel.close(200, "Bye").unwrap();
println!("Closed the channel");
info!("Closed the channel");
session.close(200, "Good Bye");
println!("Closed the session... EOF");
info!("Closed the session... EOF");
}

View file

@ -1,4 +1,5 @@
use amqp::Basic;
use log::{info, log};
use ofborg::config;
use ofborg::easyamqp::{self, TypedWrappers};
use ofborg::tasks;
@ -10,10 +11,10 @@ fn main() {
let cfg = config::load(env::args().nth(1).unwrap().as_ref());
ofborg::setup_log();
println!("Hello, world!");
info!("Hello, world!");
let mut session = easyamqp::session_from_config(&cfg.rabbitmq).unwrap();
println!("Connected to rabbitmq");
info!("Connected to rabbitmq");
let mut channel = session.open_channel(1).unwrap();
@ -84,10 +85,10 @@ fn main() {
channel.start_consuming();
println!("Finished consuming?");
info!("Finished consuming?");
channel.close(200, "Bye").unwrap();
println!("Closed the channel");
info!("Closed the channel");
session.close(200, "Good Bye");
println!("Closed the session... EOF");
info!("Closed the session... EOF");
}

View file

@ -1,4 +1,5 @@
use amqp::Basic;
use log::{info, log};
use ofborg::config;
use ofborg::easyamqp::{self, TypedWrappers};
use ofborg::tasks;
@ -10,10 +11,10 @@ fn main() {
let cfg = config::load(env::args().nth(1).unwrap().as_ref());
ofborg::setup_log();
println!("Hello, world!");
info!("Hello, world!");
let mut session = easyamqp::session_from_config(&cfg.rabbitmq).unwrap();
println!("Connected to rabbitmq");
info!("Connected to rabbitmq");
let mut channel = session.open_channel(1).unwrap();
channel
@ -85,10 +86,10 @@ fn main() {
channel.start_consuming();
println!("Finished consuming?");
info!("Finished consuming?");
channel.close(200, "Bye").unwrap();
println!("Closed the channel");
info!("Closed the channel");
session.close(200, "Good Bye");
println!("Closed the session... EOF");
info!("Closed the session... EOF");
}

View file

@ -1,4 +1,5 @@
use amqp::Basic;
use log::{info, log};
use ofborg::config;
use ofborg::easyamqp::{self, TypedWrappers};
use ofborg::tasks;
@ -68,10 +69,10 @@ fn main() {
channel.start_consuming();
println!("Finished consuming?");
info!("Finished consuming?");
channel.close(200, "Bye").unwrap();
println!("Closed the channel");
info!("Closed the channel");
session.close(200, "Good Bye");
println!("Closed the session... EOF");
info!("Closed the session... EOF");
}

View file

@ -1,3 +1,4 @@
use log::{info, log};
use ofborg::config;
use ofborg::easyamqp::{self, TypedWrappers};
use ofborg::tasks;
@ -11,7 +12,7 @@ fn main() {
ofborg::setup_log();
let mut session = easyamqp::session_from_config(&cfg.rabbitmq).unwrap();
println!("Connected to rabbitmq");
info!("Connected to rabbitmq");
let mut channel = session.open_channel(1).unwrap();
@ -71,10 +72,10 @@ fn main() {
channel.start_consuming();
println!("Finished consuming?");
info!("Finished consuming?");
channel.close(200, "Bye").unwrap();
println!("Closed the channel");
info!("Closed the channel");
session.close(200, "Good Bye");
println!("Closed the session... EOF");
info!("Closed the session... EOF");
}

View file

@ -1,3 +1,4 @@
use log::{info, log};
use ofborg::config;
use ofborg::easyamqp;
use ofborg::message::{buildjob, Pr, Repo};
@ -13,9 +14,9 @@ fn main() {
ofborg::setup_log();
let mut session = easyamqp::session_from_config(&cfg.rabbitmq).unwrap();
println!("Connected to rabbitmq");
info!("Connected to rabbitmq");
println!("About to open channel #1");
info!("About to open channel #1");
let mut chan = session.open_channel(1).unwrap();
let mut receiver = notifyworker::ChannelNotificationReceiver::new(&mut chan, 0);
@ -39,7 +40,7 @@ fn main() {
};
loop {
println!("Starting a new build simulation");
info!("Starting a new build simulation");
let mut actions =
build::JobActions::new(&cfg.nix.system, &cfg.runner.identity, &job, &mut receiver);
actions.log_started(vec![], vec![]);

View file

@ -1,4 +1,5 @@
use amqp::Basic;
use log::{error, info, log};
use ofborg::checkout;
use ofborg::config;
use ofborg::easyamqp::{self, TypedWrappers};
@ -15,7 +16,7 @@ fn main() {
if memory_info.avail < 8 * 1024 * 1024 {
// seems this stuff is in kilobytes?
println!(
error!(
"Less than 8Gb of memory available (got {:.2}Gb). Aborting.",
(memory_info.avail as f32) / 1024.0 / 1024.0
);
@ -26,10 +27,10 @@ fn main() {
ofborg::setup_log();
println!("Hello, world!");
info!("Hello, world!");
let mut session = easyamqp::session_from_config(&cfg.rabbitmq).unwrap();
println!("Connected to rabbitmq");
info!("Connected to rabbitmq");
let mut channel = session.open_channel(1).unwrap();
@ -82,10 +83,10 @@ fn main() {
channel.start_consuming();
println!("Finished consuming?");
info!("Finished consuming?");
channel.close(200, "Bye").unwrap();
println!("Closed the channel");
info!("Closed the channel");
session.close(200, "Good Bye");
println!("Closed the session... EOF");
info!("Closed the session... EOF");
}

View file

@ -1,5 +1,6 @@
use amqp::Basic;
use hyper::server::{Request, Response, Server};
use log::{info, log};
use ofborg::easyamqp::TypedWrappers;
use ofborg::{config, easyamqp, stats, tasks, worker};
@ -10,10 +11,10 @@ fn main() {
let cfg = config::load(env::args().nth(1).unwrap().as_ref());
ofborg::setup_log();
println!("Hello, world!");
info!("Hello, world!");
let mut session = easyamqp::session_from_config(&cfg.rabbitmq).unwrap();
println!("Connected to rabbitmq");
info!("Connected to rabbitmq");
let events = stats::RabbitMQ::new(
&format!("{}-{}", cfg.runner.identity.clone(), cfg.nix.system.clone()),
@ -78,7 +79,7 @@ fn main() {
thread::spawn(|| {
let addr = "0.0.0.0:9898";
println!("listening addr {:?}", addr);
info!("listening addr {:?}", addr);
Server::http(addr)
.unwrap()
.handle(move |_: Request, res: Response| {
@ -89,10 +90,10 @@ fn main() {
channel.start_consuming();
println!("Finished consuming?");
info!("Finished consuming?");
channel.close(200, "Bye").unwrap();
println!("Closed the channel");
info!("Closed the channel");
session.close(200, "Good Bye");
println!("Closed the session... EOF");
info!("Closed the session... EOF");
}