From 7430c23ccc546bd13f83478407e59db0074bd565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Sat, 23 May 2020 14:53:29 +0200 Subject: [PATCH] aquatic_ws: add simple_logger for debugging, need better solution --- Cargo.lock | 32 ++++++++++++++++++++++++++++++++ TODO.md | 2 +- aquatic_ws/Cargo.toml | 1 + aquatic_ws/src/bin/main.rs | 2 ++ 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 2b2e716..f186c39 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -112,6 +112,7 @@ dependencies = [ "rand", "serde", "serde_json", + "simple_logger", "tungstenite", ] @@ -167,6 +168,17 @@ dependencies = [ "toml", ] +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + [[package]] name = "autocfg" version = "1.0.0" @@ -507,6 +519,15 @@ dependencies = [ "serde", ] +[[package]] +name = "hermit-abi" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91780f809e750b0a89f5544be56617ff6b1227ee485bcb06ebe10cdf89bd3b71" +dependencies = [ + "libc", +] + [[package]] name = "histogram" version = "0.6.9" @@ -1186,6 +1207,17 @@ dependencies = [ "opaque-debug", ] +[[package]] +name = "simple_logger" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea0c4611f32f4c2bac73754f22dca1f57e6c1945e0590dae4e5f2a077b92367" +dependencies = [ + "atty", + "log", + "winapi", +] + [[package]] name = "smallvec" version = "1.4.0" diff --git a/TODO.md b/TODO.md index 1bfdfc3..536d3a4 100644 --- a/TODO.md +++ b/TODO.md @@ -4,11 +4,11 @@ * ipv4 / ipv6 split state? * network * send/recv buffer size config - * limit ws message sizes? * is it even necessary to check if event is readable in poll, since that is all we're listening for? * panic/error in workers: print error, exit program with non-zero exit code * privdrop +* add sensible logging method ## aquatic_udp * mio: set oneshot for epoll and kqueue? otherwise, stop reregistering? diff --git a/aquatic_ws/Cargo.toml b/aquatic_ws/Cargo.toml index de28bdc..69c992d 100644 --- a/aquatic_ws/Cargo.toml +++ b/aquatic_ws/Cargo.toml @@ -30,6 +30,7 @@ parking_lot = "0.10" rand = { version = "0.7", features = ["small_rng"] } serde = { version = "1", features = ["derive"] } serde_json = "1" +simple_logger = { version = "1", default-features = false } tungstenite = "0.10" [dev-dependencies] diff --git a/aquatic_ws/src/bin/main.rs b/aquatic_ws/src/bin/main.rs index 9a957b0..0bdd527 100644 --- a/aquatic_ws/src/bin/main.rs +++ b/aquatic_ws/src/bin/main.rs @@ -7,6 +7,8 @@ static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; fn main(){ + // ::simple_logger::init().unwrap(); + cli_helpers::run_app_with_cli_and_config::( "aquatic: webtorrent tracker", aquatic_ws::run,