diff options
author | Alex Auvolat <alex@adnab.me> | 2020-04-21 12:54:55 +0000 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2020-04-21 12:54:55 +0000 |
commit | cc4f2f1cfb30e3995edf3c1174bd06b4bc0a9bf1 (patch) | |
tree | edf151a855ea4bcc55cad64a959b430e243deffa /src/main.rs | |
parent | 53cf4d1baaa994544c02ec12f4bea28598720aa8 (diff) | |
download | garage-cc4f2f1cfb30e3995edf3c1174bd06b4bc0a9bf1.tar.gz garage-cc4f2f1cfb30e3995edf3c1174bd06b4bc0a9bf1.zip |
Pretty logging
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index 11890e57..9b75740d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,8 @@ #![recursion_limit = "1024"] +#[macro_use] +extern crate log; + mod data; mod error; @@ -190,6 +193,8 @@ pub struct RepairOpt { #[tokio::main] async fn main() { + pretty_env_logger::init(); + let opt = Opt::from_args(); let tls_config = match (opt.ca_cert, opt.client_cert, opt.client_key) { @@ -200,7 +205,7 @@ async fn main() { }), (None, None, None) => None, _ => { - eprintln!("Missing one of: --ca-cert, --node-cert, --node-key. Not using TLS."); + warn!("Missing one of: --ca-cert, --node-cert, --node-key. Not using TLS."); None } }; @@ -215,7 +220,7 @@ async fn main() { Command::Server(server_opt) => { // Abort on panic (same behavior as in Go) std::panic::set_hook(Box::new(|panic_info| { - eprintln!("{}", panic_info.to_string()); + error!("{}", panic_info.to_string()); std::process::abort(); })); @@ -237,7 +242,7 @@ async fn main() { }; if let Err(e) = resp { - eprintln!("Error: {}", e); + error!("Error: {}", e); } } @@ -414,7 +419,7 @@ async fn cmd_admin( println!("{:?}", bucket); } r => { - eprintln!("Unexpected response: {:?}", r); + error!("Unexpected response: {:?}", r); } } Ok(()) |