From 0d26370caae692f0c08a728bf349e05d2014cb9e Mon Sep 17 00:00:00 2001 From: trivernis Date: Sun, 10 Oct 2021 14:27:48 +0200 Subject: [PATCH] Update rmp-ipc and add logging Signed-off-by: trivernis --- mediarepo-daemon/Cargo.lock | 69 +++++++++++++++++++- mediarepo-daemon/Cargo.toml | 2 + mediarepo-daemon/mediarepo-socket/Cargo.lock | 4 +- mediarepo-daemon/mediarepo-socket/Cargo.toml | 2 +- mediarepo-daemon/src/main.rs | 9 +++ 5 files changed, 81 insertions(+), 5 deletions(-) diff --git a/mediarepo-daemon/Cargo.lock b/mediarepo-daemon/Cargo.lock index 78ce583..065c2ad 100644 --- a/mediarepo-daemon/Cargo.lock +++ b/mediarepo-daemon/Cargo.lock @@ -13,6 +13,15 @@ dependencies = [ "version_check", ] +[[package]] +name = "aho-corasick" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +dependencies = [ + "memchr", +] + [[package]] name = "ansi_term" version = "0.11.0" @@ -368,6 +377,19 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +[[package]] +name = "env_logger" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + [[package]] name = "foreign-types" version = "0.3.2" @@ -561,6 +583,12 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "idna" version = "0.2.3" @@ -672,6 +700,8 @@ checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" name = "mediarepo" version = "0.1.0" dependencies = [ + "env_logger", + "log", "mediarepo-core", "mediarepo-model", "mediarepo-socket", @@ -1125,6 +1155,23 @@ dependencies = [ "bitflags", ] +[[package]] +name = "regex" +version = "1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" + [[package]] name = "remove_dir_all" version = "0.5.3" @@ -1146,9 +1193,9 @@ dependencies = [ [[package]] name = "rmp-ipc" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b83ee65fefc258a2f3a2cb0b144c07f3d9bb877fda93bf29595a7ade6f99513" +checksum = "d2ada2c7329ea55e1e80f2a1ae9ddb123f93ae4b349d493273138118feadfecb" dependencies = [ "lazy_static", "log", @@ -1566,6 +1613,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "termcolor" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +dependencies = [ + "winapi-util", +] + [[package]] name = "textwrap" version = "0.11.0" @@ -1872,6 +1928,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" diff --git a/mediarepo-daemon/Cargo.toml b/mediarepo-daemon/Cargo.toml index 4ef28cf..62f1ab5 100644 --- a/mediarepo-daemon/Cargo.toml +++ b/mediarepo-daemon/Cargo.toml @@ -17,6 +17,8 @@ crate-type = ["lib"] [dependencies] toml = {version = "0.5.8", optional=true} structopt = {version="0.3.23", optional=true} +env_logger = "0.9.0" +log = "0.4.14" [dependencies.mediarepo-core] path = "./mediarepo-core" diff --git a/mediarepo-daemon/mediarepo-socket/Cargo.lock b/mediarepo-daemon/mediarepo-socket/Cargo.lock index 67f6a1e..cb74794 100644 --- a/mediarepo-daemon/mediarepo-socket/Cargo.lock +++ b/mediarepo-daemon/mediarepo-socket/Cargo.lock @@ -1099,9 +1099,9 @@ dependencies = [ [[package]] name = "rmp-ipc" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b83ee65fefc258a2f3a2cb0b144c07f3d9bb877fda93bf29595a7ade6f99513" +checksum = "d2ada2c7329ea55e1e80f2a1ae9ddb123f93ae4b349d493273138118feadfecb" dependencies = [ "lazy_static", "log", diff --git a/mediarepo-daemon/mediarepo-socket/Cargo.toml b/mediarepo-daemon/mediarepo-socket/Cargo.toml index 8c137c7..f22a635 100644 --- a/mediarepo-daemon/mediarepo-socket/Cargo.toml +++ b/mediarepo-daemon/mediarepo-socket/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -rmp-ipc = "0.4.1" +rmp-ipc = "0.4.3" serde = "1.0.130" [dependencies.mediarepo-core] diff --git a/mediarepo-daemon/src/main.rs b/mediarepo-daemon/src/main.rs index 4fd28c7..b0dbcae 100644 --- a/mediarepo-daemon/src/main.rs +++ b/mediarepo-daemon/src/main.rs @@ -40,6 +40,7 @@ enum SubCommand { #[tokio::main] async fn main() -> RepoResult<()> { + build_logger(); let opt: Opt = Opt::from_args(); match opt.cmd { SubCommand::Init { force } => init(opt, force).await, @@ -84,3 +85,11 @@ async fn init(opt: Opt, force: bool) -> RepoResult<()> { Ok(()) } + +fn build_logger() { + env_logger::builder() + .filter_module("sqlx", log::LevelFilter::Warn) + .filter_module("tokio", log::LevelFilter::Info) + .filter_module("tracing", log::LevelFilter::Warn) + .init(); +}