diff --git a/Cargo.lock b/Cargo.lock index 5e9fd14..5b4a51f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1718,6 +1718,7 @@ dependencies = [ "http 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.12.35 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.13.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "odds 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 21c835e..f6ed359 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ futures3 = { package = "futures-preview", version="0.3.0-alpha", features = ["co http = "^0.1.18" hyper = "^0.12.35" hyper13 = { package = "hyper", version="0.13.0-alpha.4", features = ["unstable-stream"] } +log = "^0.4.8" matches = "^0.1.8" odds = { version = "^0.3.1", features = ["std-vec"] } tokio2 = { package = "tokio", version="0.2.0-alpha.6" } diff --git a/src/commands/relay.rs b/src/commands/relay.rs index 0355f12..96f6514 100644 --- a/src/commands/relay.rs +++ b/src/commands/relay.rs @@ -76,7 +76,7 @@ fn post_stream(channel: Handle, stream: impl Stream Result<(), WebmetroError> { let head = channel.clone().and(warp::head()) .map(|(_, name)| { - println!("[Info] HEAD Request For Channel {}", name); + info!("HEAD Request For Channel {}", name); media_response(Body::empty()) }); let get = channel.clone().and(warp::get2()) .map(|(channel, name)| { - println!("[Info] Listener Connected On Channel {}", name); + info!("Listener Connected On Channel {}", name); media_response(Body::wrap_stream(get_stream(channel))) }); let post_put = channel.clone().and(warp::post2().or(warp::put2()).unify()) .and(warp::body::stream()).map(|(channel, name), stream| { - println!("[Info] Source Connected On Channel {}", name); + info!("Source Connected On Channel {}", name); Response::new(Body::wrap_stream(post_stream(channel, stream))) }); diff --git a/src/commands/send.rs b/src/commands/send.rs index e06b03c..7a6db14 100644 --- a/src/commands/send.rs +++ b/src/commands/send.rs @@ -51,7 +51,7 @@ pub fn run(args: &ArgMatches) -> Result<(), WebmetroError> { let chunk_stream = chunk_stream .map_ok(|webm_chunk| webm_chunk.into_bytes()) .map_err(|err| { - eprintln!("{}", &err); + warn!("{}", &err); err }); diff --git a/src/main.rs b/src/main.rs index 3962669..b086bb7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,6 @@ +#[macro_use] extern crate log; + mod commands; use clap::{App, AppSettings, crate_version}; @@ -36,6 +38,6 @@ fn main() { Ok(()) } }.unwrap_or_else(|err| { - eprintln!("Error: {}", err); + error!("{}", err); }); }