diff --git a/services/tunnelbroker/rust-notifications/Cargo.lock b/services/tunnelbroker/rust-notifications/Cargo.lock --- a/services/tunnelbroker/rust-notifications/Cargo.lock +++ b/services/tunnelbroker/rust-notifications/Cargo.lock @@ -22,6 +22,15 @@ "thiserror", ] +[[package]] +name = "aho-corasick" +version = "0.7.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +dependencies = [ + "memchr", +] + [[package]] name = "android_system_properties" version = "0.1.4" @@ -37,6 +46,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1485d4d2cc45e7b201ee3767015c96faa5904387c9d87c6efdd0fb511f12d305" +[[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.1.0" @@ -173,6 +193,19 @@ "cfg-if", ] +[[package]] +name = "env_logger" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c90bf5f19754d10198ccb95b70664fc925bd1fc090a0fd9a6ebc54acc8cd6272" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + [[package]] name = "erased-serde" version = "0.3.21" @@ -393,6 +426,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "hyper" version = "0.14.20" @@ -729,6 +768,23 @@ "bitflags", ] +[[package]] +name = "regex" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" + [[package]] name = "remove_dir_all" version = "0.5.3" @@ -798,6 +854,7 @@ "anyhow", "cxx", "cxx-build", + "env_logger", "fcm", "lazy_static", "log", diff --git a/services/tunnelbroker/rust-notifications/Cargo.toml b/services/tunnelbroker/rust-notifications/Cargo.toml --- a/services/tunnelbroker/rust-notifications/Cargo.toml +++ b/services/tunnelbroker/rust-notifications/Cargo.toml @@ -13,6 +13,7 @@ a2 = "0.6" cxx = "1.0" log = "0.4" +env_logger = "0.9" fcm = "0.9" anyhow = "1.0" openssl = { version = "0.10", features = ["vendored"] } diff --git a/services/tunnelbroker/rust-notifications/src/lib.rs b/services/tunnelbroker/rust-notifications/src/lib.rs --- a/services/tunnelbroker/rust-notifications/src/lib.rs +++ b/services/tunnelbroker/rust-notifications/src/lib.rs @@ -1,5 +1,7 @@ use anyhow::Result; +use env_logger; use lazy_static::lazy_static; +use log::info; use tokio::runtime::Runtime; pub mod apns; pub mod fcm; @@ -27,8 +29,11 @@ } lazy_static! { - // Lazy static Tokio runtime initialization - pub static ref RUNTIME: Runtime = Runtime::new().unwrap(); + pub static ref RUNTIME: Runtime = { + env_logger::init(); + info!("Tokio runtime initialization"); + Runtime::new().unwrap() + }; } pub fn send_notif_to_apns(