]> piware.de Git - learn-rust.git/commitdiff
warp-server: Proper websocket error reporting
authorMartin Pitt <martin@piware.de>
Tue, 1 Nov 2022 18:22:43 +0000 (19:22 +0100)
committerMartin Pitt <martin@piware.de>
Tue, 1 Nov 2022 18:22:43 +0000 (19:22 +0100)
warp-server/Cargo.toml
warp-server/src/main.rs

index 600b635b28f0f9b164ed3be25544a7b757415f89..3f804c5cbf53549301447b294633ab79758f057f 100644 (file)
@@ -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"
index 1c75e734d32aca6e9552489815a19eb31d537e59..c8ecdf2bb95d28b2e8f9236cc3e959b2b28e7810 100644 (file)
@@ -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);
                     }
                 })
             })