From: Martin Pitt Date: Tue, 1 Nov 2022 18:22:43 +0000 (+0100) Subject: warp-server: Proper websocket error reporting X-Git-Url: https://piware.de/gitweb/?a=commitdiff_plain;h=0791d9aed3be3e14cd24c622283b435aa0b7818f;p=learn-rust.git warp-server: Proper websocket error reporting --- diff --git a/warp-server/Cargo.toml b/warp-server/Cargo.toml index 600b635..3f804c5 100644 --- a/warp-server/Cargo.toml +++ b/warp-server/Cargo.toml @@ -9,4 +9,5 @@ edition = "2021" futures-util = { version = "0.3", default-features = false, features = ["sink"] } tokio = { version = "1", features = ["full"] } env_logger = "0.9" +log = "0.4" warp = "0.3" diff --git a/warp-server/src/main.rs b/warp-server/src/main.rs index 1c75e73..c8ecdf2 100644 --- a/warp-server/src/main.rs +++ b/warp-server/src/main.rs @@ -19,7 +19,7 @@ async fn main() { let (tx, rx) = websocket.split(); rx.forward(tx).map(|result| { if let Err(e) = result { - eprintln!("websocket error: {:?}", e); + log::warn!("websocket error: {:?}", e); } }) })