forked from the-distro/ofborg
bin/*: replace {e,}println!
s with log
macros
May as well be consistent.
This commit is contained in:
parent
1b8cec63f2
commit
c9d4bb1fd8
|
@ -1,3 +1,4 @@
|
||||||
|
use log::{info, log};
|
||||||
use ofborg::commentparser;
|
use ofborg::commentparser;
|
||||||
use ofborg::config;
|
use ofborg::config;
|
||||||
use ofborg::easyamqp;
|
use ofborg::easyamqp;
|
||||||
|
@ -11,10 +12,10 @@ fn main() {
|
||||||
let cfg = config::load(env::args().nth(1).unwrap().as_ref());
|
let cfg = config::load(env::args().nth(1).unwrap().as_ref());
|
||||||
ofborg::setup_log();
|
ofborg::setup_log();
|
||||||
|
|
||||||
println!("Hello, world!");
|
info!("Hello, world!");
|
||||||
|
|
||||||
let mut session = easyamqp::session_from_config(&cfg.rabbitmq).unwrap();
|
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();
|
let mut channel = session.open_channel(1).unwrap();
|
||||||
|
|
||||||
|
@ -56,7 +57,7 @@ fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
channel.close(200, "Bye").unwrap();
|
channel.close(200, "Bye").unwrap();
|
||||||
println!("Closed the channel");
|
info!("Closed the channel");
|
||||||
session.close(200, "Good Bye");
|
session.close(200, "Good Bye");
|
||||||
println!("Closed the session... EOF");
|
info!("Closed the session... EOF");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use amqp::Basic;
|
use amqp::Basic;
|
||||||
use log::{log, warn};
|
use log::{info, log, warn};
|
||||||
use ofborg::checkout;
|
use ofborg::checkout;
|
||||||
use ofborg::config;
|
use ofborg::config;
|
||||||
use ofborg::easyamqp::{self, TypedWrappers};
|
use ofborg::easyamqp::{self, TypedWrappers};
|
||||||
|
@ -103,10 +103,10 @@ fn main() {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
println!("Fetching jobs from {}", &queue_name);
|
info!("Fetching jobs from {}", &queue_name);
|
||||||
channel.start_consuming();
|
channel.start_consuming();
|
||||||
channel.close(200, "Bye").unwrap();
|
channel.close(200, "Bye").unwrap();
|
||||||
println!("Closed the channel");
|
info!("Closed the channel");
|
||||||
session.close(200, "Good Bye");
|
session.close(200, "Good Bye");
|
||||||
println!("Closed the session... EOF");
|
info!("Closed the session... EOF");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use amqp::Basic;
|
use amqp::Basic;
|
||||||
|
use log::{info, log};
|
||||||
use ofborg::config;
|
use ofborg::config;
|
||||||
use ofborg::easyamqp::{self, TypedWrappers};
|
use ofborg::easyamqp::{self, TypedWrappers};
|
||||||
use ofborg::tasks;
|
use ofborg::tasks;
|
||||||
|
@ -10,10 +11,10 @@ fn main() {
|
||||||
let cfg = config::load(env::args().nth(1).unwrap().as_ref());
|
let cfg = config::load(env::args().nth(1).unwrap().as_ref());
|
||||||
ofborg::setup_log();
|
ofborg::setup_log();
|
||||||
|
|
||||||
println!("Hello, world!");
|
info!("Hello, world!");
|
||||||
|
|
||||||
let mut session = easyamqp::session_from_config(&cfg.rabbitmq).unwrap();
|
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();
|
let mut channel = session.open_channel(1).unwrap();
|
||||||
|
|
||||||
|
@ -84,10 +85,10 @@ fn main() {
|
||||||
|
|
||||||
channel.start_consuming();
|
channel.start_consuming();
|
||||||
|
|
||||||
println!("Finished consuming?");
|
info!("Finished consuming?");
|
||||||
|
|
||||||
channel.close(200, "Bye").unwrap();
|
channel.close(200, "Bye").unwrap();
|
||||||
println!("Closed the channel");
|
info!("Closed the channel");
|
||||||
session.close(200, "Good Bye");
|
session.close(200, "Good Bye");
|
||||||
println!("Closed the session... EOF");
|
info!("Closed the session... EOF");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use amqp::Basic;
|
use amqp::Basic;
|
||||||
|
use log::{info, log};
|
||||||
use ofborg::config;
|
use ofborg::config;
|
||||||
use ofborg::easyamqp::{self, TypedWrappers};
|
use ofborg::easyamqp::{self, TypedWrappers};
|
||||||
use ofborg::tasks;
|
use ofborg::tasks;
|
||||||
|
@ -10,10 +11,10 @@ fn main() {
|
||||||
let cfg = config::load(env::args().nth(1).unwrap().as_ref());
|
let cfg = config::load(env::args().nth(1).unwrap().as_ref());
|
||||||
ofborg::setup_log();
|
ofborg::setup_log();
|
||||||
|
|
||||||
println!("Hello, world!");
|
info!("Hello, world!");
|
||||||
|
|
||||||
let mut session = easyamqp::session_from_config(&cfg.rabbitmq).unwrap();
|
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();
|
let mut channel = session.open_channel(1).unwrap();
|
||||||
channel
|
channel
|
||||||
|
@ -85,10 +86,10 @@ fn main() {
|
||||||
|
|
||||||
channel.start_consuming();
|
channel.start_consuming();
|
||||||
|
|
||||||
println!("Finished consuming?");
|
info!("Finished consuming?");
|
||||||
|
|
||||||
channel.close(200, "Bye").unwrap();
|
channel.close(200, "Bye").unwrap();
|
||||||
println!("Closed the channel");
|
info!("Closed the channel");
|
||||||
session.close(200, "Good Bye");
|
session.close(200, "Good Bye");
|
||||||
println!("Closed the session... EOF");
|
info!("Closed the session... EOF");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use amqp::Basic;
|
use amqp::Basic;
|
||||||
|
use log::{info, log};
|
||||||
use ofborg::config;
|
use ofborg::config;
|
||||||
use ofborg::easyamqp::{self, TypedWrappers};
|
use ofborg::easyamqp::{self, TypedWrappers};
|
||||||
use ofborg::tasks;
|
use ofborg::tasks;
|
||||||
|
@ -68,10 +69,10 @@ fn main() {
|
||||||
|
|
||||||
channel.start_consuming();
|
channel.start_consuming();
|
||||||
|
|
||||||
println!("Finished consuming?");
|
info!("Finished consuming?");
|
||||||
|
|
||||||
channel.close(200, "Bye").unwrap();
|
channel.close(200, "Bye").unwrap();
|
||||||
println!("Closed the channel");
|
info!("Closed the channel");
|
||||||
session.close(200, "Good Bye");
|
session.close(200, "Good Bye");
|
||||||
println!("Closed the session... EOF");
|
info!("Closed the session... EOF");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use log::{info, log};
|
||||||
use ofborg::config;
|
use ofborg::config;
|
||||||
use ofborg::easyamqp::{self, TypedWrappers};
|
use ofborg::easyamqp::{self, TypedWrappers};
|
||||||
use ofborg::tasks;
|
use ofborg::tasks;
|
||||||
|
@ -11,7 +12,7 @@ fn main() {
|
||||||
ofborg::setup_log();
|
ofborg::setup_log();
|
||||||
|
|
||||||
let mut session = easyamqp::session_from_config(&cfg.rabbitmq).unwrap();
|
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();
|
let mut channel = session.open_channel(1).unwrap();
|
||||||
|
|
||||||
|
@ -71,10 +72,10 @@ fn main() {
|
||||||
|
|
||||||
channel.start_consuming();
|
channel.start_consuming();
|
||||||
|
|
||||||
println!("Finished consuming?");
|
info!("Finished consuming?");
|
||||||
|
|
||||||
channel.close(200, "Bye").unwrap();
|
channel.close(200, "Bye").unwrap();
|
||||||
println!("Closed the channel");
|
info!("Closed the channel");
|
||||||
session.close(200, "Good Bye");
|
session.close(200, "Good Bye");
|
||||||
println!("Closed the session... EOF");
|
info!("Closed the session... EOF");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use log::{info, log};
|
||||||
use ofborg::config;
|
use ofborg::config;
|
||||||
use ofborg::easyamqp;
|
use ofborg::easyamqp;
|
||||||
use ofborg::message::{buildjob, Pr, Repo};
|
use ofborg::message::{buildjob, Pr, Repo};
|
||||||
|
@ -13,9 +14,9 @@ fn main() {
|
||||||
ofborg::setup_log();
|
ofborg::setup_log();
|
||||||
|
|
||||||
let mut session = easyamqp::session_from_config(&cfg.rabbitmq).unwrap();
|
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 chan = session.open_channel(1).unwrap();
|
||||||
|
|
||||||
let mut receiver = notifyworker::ChannelNotificationReceiver::new(&mut chan, 0);
|
let mut receiver = notifyworker::ChannelNotificationReceiver::new(&mut chan, 0);
|
||||||
|
@ -39,7 +40,7 @@ fn main() {
|
||||||
};
|
};
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
println!("Starting a new build simulation");
|
info!("Starting a new build simulation");
|
||||||
let mut actions =
|
let mut actions =
|
||||||
build::JobActions::new(&cfg.nix.system, &cfg.runner.identity, &job, &mut receiver);
|
build::JobActions::new(&cfg.nix.system, &cfg.runner.identity, &job, &mut receiver);
|
||||||
actions.log_started(vec![], vec![]);
|
actions.log_started(vec![], vec![]);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use amqp::Basic;
|
use amqp::Basic;
|
||||||
|
use log::{error, info, log};
|
||||||
use ofborg::checkout;
|
use ofborg::checkout;
|
||||||
use ofborg::config;
|
use ofborg::config;
|
||||||
use ofborg::easyamqp::{self, TypedWrappers};
|
use ofborg::easyamqp::{self, TypedWrappers};
|
||||||
|
@ -15,7 +16,7 @@ fn main() {
|
||||||
|
|
||||||
if memory_info.avail < 8 * 1024 * 1024 {
|
if memory_info.avail < 8 * 1024 * 1024 {
|
||||||
// seems this stuff is in kilobytes?
|
// seems this stuff is in kilobytes?
|
||||||
println!(
|
error!(
|
||||||
"Less than 8Gb of memory available (got {:.2}Gb). Aborting.",
|
"Less than 8Gb of memory available (got {:.2}Gb). Aborting.",
|
||||||
(memory_info.avail as f32) / 1024.0 / 1024.0
|
(memory_info.avail as f32) / 1024.0 / 1024.0
|
||||||
);
|
);
|
||||||
|
@ -26,10 +27,10 @@ fn main() {
|
||||||
|
|
||||||
ofborg::setup_log();
|
ofborg::setup_log();
|
||||||
|
|
||||||
println!("Hello, world!");
|
info!("Hello, world!");
|
||||||
|
|
||||||
let mut session = easyamqp::session_from_config(&cfg.rabbitmq).unwrap();
|
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();
|
let mut channel = session.open_channel(1).unwrap();
|
||||||
|
|
||||||
|
@ -82,10 +83,10 @@ fn main() {
|
||||||
|
|
||||||
channel.start_consuming();
|
channel.start_consuming();
|
||||||
|
|
||||||
println!("Finished consuming?");
|
info!("Finished consuming?");
|
||||||
|
|
||||||
channel.close(200, "Bye").unwrap();
|
channel.close(200, "Bye").unwrap();
|
||||||
println!("Closed the channel");
|
info!("Closed the channel");
|
||||||
session.close(200, "Good Bye");
|
session.close(200, "Good Bye");
|
||||||
println!("Closed the session... EOF");
|
info!("Closed the session... EOF");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use amqp::Basic;
|
use amqp::Basic;
|
||||||
use hyper::server::{Request, Response, Server};
|
use hyper::server::{Request, Response, Server};
|
||||||
|
use log::{info, log};
|
||||||
use ofborg::easyamqp::TypedWrappers;
|
use ofborg::easyamqp::TypedWrappers;
|
||||||
use ofborg::{config, easyamqp, stats, tasks, worker};
|
use ofborg::{config, easyamqp, stats, tasks, worker};
|
||||||
|
|
||||||
|
@ -10,10 +11,10 @@ fn main() {
|
||||||
let cfg = config::load(env::args().nth(1).unwrap().as_ref());
|
let cfg = config::load(env::args().nth(1).unwrap().as_ref());
|
||||||
ofborg::setup_log();
|
ofborg::setup_log();
|
||||||
|
|
||||||
println!("Hello, world!");
|
info!("Hello, world!");
|
||||||
|
|
||||||
let mut session = easyamqp::session_from_config(&cfg.rabbitmq).unwrap();
|
let mut session = easyamqp::session_from_config(&cfg.rabbitmq).unwrap();
|
||||||
println!("Connected to rabbitmq");
|
info!("Connected to rabbitmq");
|
||||||
|
|
||||||
let events = stats::RabbitMQ::new(
|
let events = stats::RabbitMQ::new(
|
||||||
&format!("{}-{}", cfg.runner.identity.clone(), cfg.nix.system.clone()),
|
&format!("{}-{}", cfg.runner.identity.clone(), cfg.nix.system.clone()),
|
||||||
|
@ -78,7 +79,7 @@ fn main() {
|
||||||
|
|
||||||
thread::spawn(|| {
|
thread::spawn(|| {
|
||||||
let addr = "0.0.0.0:9898";
|
let addr = "0.0.0.0:9898";
|
||||||
println!("listening addr {:?}", addr);
|
info!("listening addr {:?}", addr);
|
||||||
Server::http(addr)
|
Server::http(addr)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.handle(move |_: Request, res: Response| {
|
.handle(move |_: Request, res: Response| {
|
||||||
|
@ -89,10 +90,10 @@ fn main() {
|
||||||
|
|
||||||
channel.start_consuming();
|
channel.start_consuming();
|
||||||
|
|
||||||
println!("Finished consuming?");
|
info!("Finished consuming?");
|
||||||
|
|
||||||
channel.close(200, "Bye").unwrap();
|
channel.close(200, "Bye").unwrap();
|
||||||
println!("Closed the channel");
|
info!("Closed the channel");
|
||||||
session.close(200, "Good Bye");
|
session.close(200, "Good Bye");
|
||||||
println!("Closed the session... EOF");
|
info!("Closed the session... EOF");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue