diff --git a/commons/zenoh-codec/tests/codec.rs b/commons/zenoh-codec/tests/codec.rs index 46fabe5c51..7af1ce64d1 100644 --- a/commons/zenoh-codec/tests/codec.rs +++ b/commons/zenoh-codec/tests/codec.rs @@ -388,7 +388,7 @@ fn codec_shm_info() { // Common #[test] fn codec_extension() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); macro_rules! run_extension_single { ($ext:ty, $buff:expr) => { diff --git a/examples/examples/z_alloc_shm.rs b/examples/examples/z_alloc_shm.rs index e96ca7dab1..c955319e27 100644 --- a/examples/examples/z_alloc_shm.rs +++ b/examples/examples/z_alloc_shm.rs @@ -23,7 +23,7 @@ use zenoh::{ #[tokio::main] async fn main() { // Initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); run().await.unwrap() } diff --git a/examples/examples/z_delete.rs b/examples/examples/z_delete.rs index 090aadac48..4d1e217ea4 100644 --- a/examples/examples/z_delete.rs +++ b/examples/examples/z_delete.rs @@ -18,7 +18,7 @@ use zenoh_examples::CommonArgs; #[tokio::main] async fn main() { // initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, key_expr) = parse_args(); diff --git a/examples/examples/z_forward.rs b/examples/examples/z_forward.rs index be9df7e2b0..8654a8f420 100644 --- a/examples/examples/z_forward.rs +++ b/examples/examples/z_forward.rs @@ -19,7 +19,7 @@ use zenoh_ext::SubscriberForward; #[tokio::main] async fn main() { // Initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, key_expr, forward) = parse_args(); diff --git a/examples/examples/z_get.rs b/examples/examples/z_get.rs index a83eeb5034..7966d5938a 100644 --- a/examples/examples/z_get.rs +++ b/examples/examples/z_get.rs @@ -23,7 +23,7 @@ use zenoh_examples::CommonArgs; #[tokio::main] async fn main() { // initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, selector, payload, target, timeout) = parse_args(); diff --git a/examples/examples/z_get_liveliness.rs b/examples/examples/z_get_liveliness.rs index 53f7abc92a..f057d81ba2 100644 --- a/examples/examples/z_get_liveliness.rs +++ b/examples/examples/z_get_liveliness.rs @@ -20,7 +20,7 @@ use zenoh_examples::CommonArgs; #[tokio::main] async fn main() { // initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, key_expr, timeout) = parse_args(); diff --git a/examples/examples/z_get_shm.rs b/examples/examples/z_get_shm.rs index b3c2dedd6e..a3d8a22931 100644 --- a/examples/examples/z_get_shm.rs +++ b/examples/examples/z_get_shm.rs @@ -29,7 +29,7 @@ const N: usize = 10; #[tokio::main] async fn main() { // initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, selector, mut payload, target, timeout) = parse_args(); diff --git a/examples/examples/z_info.rs b/examples/examples/z_info.rs index aa40ef62d4..d7859b5de2 100644 --- a/examples/examples/z_info.rs +++ b/examples/examples/z_info.rs @@ -18,7 +18,7 @@ use zenoh_examples::CommonArgs; #[tokio::main] async fn main() { // initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let config = parse_args(); diff --git a/examples/examples/z_liveliness.rs b/examples/examples/z_liveliness.rs index bf8890a267..2f102d1f93 100644 --- a/examples/examples/z_liveliness.rs +++ b/examples/examples/z_liveliness.rs @@ -18,7 +18,7 @@ use zenoh_examples::CommonArgs; #[tokio::main] async fn main() { // Initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, key_expr) = parse_args(); diff --git a/examples/examples/z_ping.rs b/examples/examples/z_ping.rs index eec9324173..cd40945ad8 100644 --- a/examples/examples/z_ping.rs +++ b/examples/examples/z_ping.rs @@ -19,7 +19,7 @@ use zenoh_examples::CommonArgs; fn main() { // initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, warmup, size, n, express) = parse_args(); let session = zenoh::open(config).wait().unwrap(); diff --git a/examples/examples/z_ping_shm.rs b/examples/examples/z_ping_shm.rs index de33819818..bc948af4d0 100644 --- a/examples/examples/z_ping_shm.rs +++ b/examples/examples/z_ping_shm.rs @@ -26,7 +26,7 @@ use zenoh_examples::CommonArgs; fn main() { // Initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, warmup, size, n) = parse_args(); diff --git a/examples/examples/z_pong.rs b/examples/examples/z_pong.rs index 86b31d41f3..2867d7cea6 100644 --- a/examples/examples/z_pong.rs +++ b/examples/examples/z_pong.rs @@ -17,7 +17,7 @@ use zenoh_examples::CommonArgs; fn main() { // initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, express) = parse_args(); diff --git a/examples/examples/z_pub.rs b/examples/examples/z_pub.rs index 4ff177c32a..cc97a99971 100644 --- a/examples/examples/z_pub.rs +++ b/examples/examples/z_pub.rs @@ -20,7 +20,7 @@ use zenoh_examples::CommonArgs; #[tokio::main] async fn main() { // Initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, key_expr, payload, attachment) = parse_args(); diff --git a/examples/examples/z_pub_shm.rs b/examples/examples/z_pub_shm.rs index 6731ae8d0d..1fe89f9cf8 100644 --- a/examples/examples/z_pub_shm.rs +++ b/examples/examples/z_pub_shm.rs @@ -27,7 +27,7 @@ const N: usize = 10; #[tokio::main] async fn main() -> Result<(), ZError> { // Initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, path, payload) = parse_args(); diff --git a/examples/examples/z_pub_shm_thr.rs b/examples/examples/z_pub_shm_thr.rs index 17bd6de804..c3385c0b94 100644 --- a/examples/examples/z_pub_shm_thr.rs +++ b/examples/examples/z_pub_shm_thr.rs @@ -24,7 +24,7 @@ use zenoh_examples::CommonArgs; #[tokio::main] async fn main() { // initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, sm_size, size) = parse_args(); let z = zenoh::open(config).await.unwrap(); diff --git a/examples/examples/z_pub_thr.rs b/examples/examples/z_pub_thr.rs index e6c063318e..9014f78763 100644 --- a/examples/examples/z_pub_thr.rs +++ b/examples/examples/z_pub_thr.rs @@ -24,7 +24,7 @@ use zenoh_examples::CommonArgs; fn main() { // initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let args = Args::parse(); let mut prio = Priority::DEFAULT; diff --git a/examples/examples/z_pull.rs b/examples/examples/z_pull.rs index 6716ef8cc5..e04e1a6b32 100644 --- a/examples/examples/z_pull.rs +++ b/examples/examples/z_pull.rs @@ -20,7 +20,7 @@ use zenoh_examples::CommonArgs; #[tokio::main] async fn main() { // initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, key_expr, size, interval) = parse_args(); diff --git a/examples/examples/z_put.rs b/examples/examples/z_put.rs index 0097f99139..ea2bb72e8e 100644 --- a/examples/examples/z_put.rs +++ b/examples/examples/z_put.rs @@ -18,7 +18,7 @@ use zenoh_examples::CommonArgs; #[tokio::main] async fn main() { // initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, key_expr, payload) = parse_args(); diff --git a/examples/examples/z_put_float.rs b/examples/examples/z_put_float.rs index 35ece437f3..df17470911 100644 --- a/examples/examples/z_put_float.rs +++ b/examples/examples/z_put_float.rs @@ -18,7 +18,7 @@ use zenoh_examples::CommonArgs; #[tokio::main] async fn main() { // initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, key_expr, payload) = parse_args(); diff --git a/examples/examples/z_queryable.rs b/examples/examples/z_queryable.rs index 4b950a0a33..7ea3b7b5a1 100644 --- a/examples/examples/z_queryable.rs +++ b/examples/examples/z_queryable.rs @@ -18,7 +18,7 @@ use zenoh_examples::CommonArgs; #[tokio::main] async fn main() { // initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, key_expr, payload, complete) = parse_args(); diff --git a/examples/examples/z_queryable_shm.rs b/examples/examples/z_queryable_shm.rs index e92efbdc38..f1c65e51bf 100644 --- a/examples/examples/z_queryable_shm.rs +++ b/examples/examples/z_queryable_shm.rs @@ -29,7 +29,7 @@ const N: usize = 10; #[tokio::main] async fn main() { // initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, key_expr, payload, complete) = parse_args(); diff --git a/examples/examples/z_scout.rs b/examples/examples/z_scout.rs index 1d485991fd..be8d9f68d4 100644 --- a/examples/examples/z_scout.rs +++ b/examples/examples/z_scout.rs @@ -16,7 +16,7 @@ use zenoh::{config::WhatAmI, scout, Config}; #[tokio::main] async fn main() { // initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); println!("Scouting..."); let receiver = scout(WhatAmI::Peer | WhatAmI::Router, Config::default()) diff --git a/examples/examples/z_storage.rs b/examples/examples/z_storage.rs index f812c78094..2cce1640b7 100644 --- a/examples/examples/z_storage.rs +++ b/examples/examples/z_storage.rs @@ -28,7 +28,7 @@ use zenoh_examples::CommonArgs; #[tokio::main] async fn main() { // initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, key_expr, complete) = parse_args(); diff --git a/examples/examples/z_sub.rs b/examples/examples/z_sub.rs index 7f3a93c5fb..8f48dee25c 100644 --- a/examples/examples/z_sub.rs +++ b/examples/examples/z_sub.rs @@ -18,7 +18,7 @@ use zenoh_examples::CommonArgs; #[tokio::main] async fn main() { // Initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, key_expr) = parse_args(); diff --git a/examples/examples/z_sub_liveliness.rs b/examples/examples/z_sub_liveliness.rs index 93d063a344..be729e34d1 100644 --- a/examples/examples/z_sub_liveliness.rs +++ b/examples/examples/z_sub_liveliness.rs @@ -18,7 +18,7 @@ use zenoh_examples::CommonArgs; #[tokio::main] async fn main() { // Initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, key_expr, history) = parse_args(); diff --git a/examples/examples/z_sub_shm.rs b/examples/examples/z_sub_shm.rs index f45dab099d..215268501d 100644 --- a/examples/examples/z_sub_shm.rs +++ b/examples/examples/z_sub_shm.rs @@ -20,7 +20,7 @@ use zenoh_examples::CommonArgs; #[tokio::main] async fn main() { // Initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, key_expr) = parse_args(); diff --git a/examples/examples/z_sub_thr.rs b/examples/examples/z_sub_thr.rs index 78626d1d1d..7098a52134 100644 --- a/examples/examples/z_sub_thr.rs +++ b/examples/examples/z_sub_thr.rs @@ -69,7 +69,7 @@ impl Drop for Stats { fn main() { // initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, m, n) = parse_args(); diff --git a/io/zenoh-transport/tests/endpoints.rs b/io/zenoh-transport/tests/endpoints.rs index f4ddbd6ec4..7fe2f949ef 100644 --- a/io/zenoh-transport/tests/endpoints.rs +++ b/io/zenoh-transport/tests/endpoints.rs @@ -100,7 +100,7 @@ async fn run(endpoints: &[EndPoint]) { #[cfg(feature = "transport_tcp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn endpoint_tcp() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locators let endpoints: Vec = vec![ format!("tcp/127.0.0.1:{}", 7000).parse().unwrap(), @@ -113,7 +113,7 @@ async fn endpoint_tcp() { #[cfg(feature = "transport_udp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn endpoint_udp() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locators let endpoints: Vec = vec![ format!("udp/127.0.0.1:{}", 7010).parse().unwrap(), @@ -126,7 +126,7 @@ async fn endpoint_udp() { #[cfg(all(feature = "transport_unixsock-stream", target_family = "unix"))] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn endpoint_unix() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Remove the files if they still exists let f1 = "zenoh-test-unix-socket-0.sock"; let f2 = "zenoh-test-unix-socket-1.sock"; @@ -147,7 +147,7 @@ async fn endpoint_unix() { #[cfg(feature = "transport_ws")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn endpoint_ws() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locators let endpoints: Vec = vec![ format!("ws/127.0.0.1:{}", 7020).parse().unwrap(), @@ -160,7 +160,7 @@ async fn endpoint_ws() { #[cfg(feature = "transport_unixpipe")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn endpoint_unixpipe() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locators let endpoints: Vec = vec![ "unixpipe/endpoint_unixpipe".parse().unwrap(), @@ -174,7 +174,7 @@ async fn endpoint_unixpipe() { #[cfg(all(feature = "transport_tcp", feature = "transport_udp"))] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn endpoint_tcp_udp() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locators let endpoints: Vec = vec![ format!("tcp/127.0.0.1:{}", 7030).parse().unwrap(), @@ -193,7 +193,7 @@ async fn endpoint_tcp_udp() { ))] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn endpoint_tcp_udp_unix() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Remove the file if it still exists let f1 = "zenoh-test-unix-socket-2.sock"; let _ = std::fs::remove_file(f1); @@ -217,7 +217,7 @@ async fn endpoint_tcp_udp_unix() { ))] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn endpoint_tcp_unix() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Remove the file if it still exists let f1 = "zenoh-test-unix-socket-3.sock"; let _ = std::fs::remove_file(f1); @@ -239,7 +239,7 @@ async fn endpoint_tcp_unix() { ))] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn endpoint_udp_unix() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Remove the file if it still exists let f1 = "zenoh-test-unix-socket-4.sock"; let _ = std::fs::remove_file(f1); // Define the locators @@ -258,7 +258,7 @@ async fn endpoint_udp_unix() { async fn endpoint_tls() { use zenoh_link::tls::config::*; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // NOTE: this an auto-generated pair of certificate and key. // The target domain is localhost, so it has no real @@ -337,7 +337,7 @@ AXVFFIgCSluyrolaD6CWD9MqOex4YOfJR2bNxI7lFvuK4AwjyUJzT1U1HXib17mM async fn endpoint_quic() { use zenoh_link::quic::config::*; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // NOTE: this an auto-generated pair of certificate and key. // The target domain is localhost, so it has no real @@ -413,7 +413,7 @@ AXVFFIgCSluyrolaD6CWD9MqOex4YOfJR2bNxI7lFvuK4AwjyUJzT1U1HXib17mM #[cfg(all(feature = "transport_vsock", target_os = "linux"))] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn endpoint_vsock() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locators let endpoints: Vec = vec![ "vsock/-1:1234".parse().unwrap(), diff --git a/io/zenoh-transport/tests/multicast_compression.rs b/io/zenoh-transport/tests/multicast_compression.rs index 129f79d55e..3b8715c0df 100644 --- a/io/zenoh-transport/tests/multicast_compression.rs +++ b/io/zenoh-transport/tests/multicast_compression.rs @@ -335,7 +335,7 @@ mod tests { #[cfg(feature = "transport_udp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_multicast_compression_udp_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locator let endpoints: Vec = vec![ diff --git a/io/zenoh-transport/tests/multicast_transport.rs b/io/zenoh-transport/tests/multicast_transport.rs index 0ffefb59b2..664de47ffb 100644 --- a/io/zenoh-transport/tests/multicast_transport.rs +++ b/io/zenoh-transport/tests/multicast_transport.rs @@ -332,7 +332,7 @@ mod tests { #[cfg(all(feature = "transport_compression", feature = "transport_udp"))] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_multicast_udp_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locator let endpoints: Vec = vec![ diff --git a/io/zenoh-transport/tests/transport_whitelist.rs b/io/zenoh-transport/tests/transport_whitelist.rs index 121db5b5d6..f8428b457d 100644 --- a/io/zenoh-transport/tests/transport_whitelist.rs +++ b/io/zenoh-transport/tests/transport_whitelist.rs @@ -118,7 +118,7 @@ async fn run(endpoints: &[EndPoint]) { #[cfg(feature = "transport_tcp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_whitelist_tcp() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locators let endpoints: Vec = vec![ @@ -133,7 +133,7 @@ async fn transport_whitelist_tcp() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn transport_whitelist_unixpipe() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locators let endpoints: Vec = vec![ @@ -147,7 +147,7 @@ async fn transport_whitelist_unixpipe() { #[cfg(all(feature = "transport_vsock", target_os = "linux"))] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_whitelist_vsock() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locators let endpoints: Vec = vec![ diff --git a/io/zenoh-transport/tests/unicast_authenticator.rs b/io/zenoh-transport/tests/unicast_authenticator.rs index 87f2174598..a9b22ad5bb 100644 --- a/io/zenoh-transport/tests/unicast_authenticator.rs +++ b/io/zenoh-transport/tests/unicast_authenticator.rs @@ -629,7 +629,7 @@ async fn run_with_lowlatency_transport(endpoint: &EndPoint) { #[cfg(feature = "transport_tcp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn authenticator_tcp() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("tcp/127.0.0.1:{}", 8000).parse().unwrap(); run_with_universal_transport(&endpoint).await; } @@ -637,7 +637,7 @@ async fn authenticator_tcp() { #[cfg(feature = "transport_tcp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn authenticator_tcp_with_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("tcp/127.0.0.1:{}", 8100).parse().unwrap(); run_with_lowlatency_transport(&endpoint).await; } @@ -645,7 +645,7 @@ async fn authenticator_tcp_with_lowlatency_transport() { #[cfg(feature = "transport_udp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn authenticator_udp() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("udp/127.0.0.1:{}", 8010).parse().unwrap(); run_with_universal_transport(&endpoint).await; } @@ -653,7 +653,7 @@ async fn authenticator_udp() { #[cfg(feature = "transport_udp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn authenticator_udp_with_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("udp/127.0.0.1:{}", 8110).parse().unwrap(); run_with_lowlatency_transport(&endpoint).await; } @@ -662,7 +662,7 @@ async fn authenticator_udp_with_lowlatency_transport() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn authenticator_unixpipe() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = "unixpipe/authenticator_unixpipe_test".parse().unwrap(); run_with_universal_transport(&endpoint).await; } @@ -671,7 +671,7 @@ async fn authenticator_unixpipe() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn authenticator_unixpipe_with_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = "unixpipe/authenticator_unixpipe_with_lowlatency_transport" .parse() .unwrap(); @@ -682,7 +682,7 @@ async fn authenticator_unixpipe_with_lowlatency_transport() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn authenticator_ws() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("ws/127.0.0.1:{}", 8020).parse().unwrap(); run_with_universal_transport(&endpoint).await; } @@ -691,7 +691,7 @@ async fn authenticator_ws() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn authenticator_ws_with_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("ws/127.0.0.1:{}", 8120).parse().unwrap(); run_with_lowlatency_transport(&endpoint).await; } @@ -699,7 +699,7 @@ async fn authenticator_ws_with_lowlatency_transport() { #[cfg(all(feature = "transport_unixsock-stream", target_family = "unix"))] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn authenticator_unix() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let f1 = "zenoh-test-unix-socket-10.sock"; let _ = std::fs::remove_file(f1); let endpoint: EndPoint = format!("unixsock-stream/{f1}").parse().unwrap(); @@ -713,7 +713,7 @@ async fn authenticator_unix() { async fn authenticator_tls() { use zenoh_link::tls::config::*; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // NOTE: this an auto-generated pair of certificate and key. // The target domain is localhost, so it has no real @@ -813,7 +813,7 @@ R+IdLiXcyIkg0m9N8I17p0ljCSkbrgGMD3bbePRTfg== async fn authenticator_quic() { use zenoh_link::quic::config::*; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // NOTE: this an auto-generated pair of certificate and key. // The target domain is localhost, so it has no real diff --git a/io/zenoh-transport/tests/unicast_compression.rs b/io/zenoh-transport/tests/unicast_compression.rs index e5015c3d25..7b18983b4b 100644 --- a/io/zenoh-transport/tests/unicast_compression.rs +++ b/io/zenoh-transport/tests/unicast_compression.rs @@ -421,7 +421,7 @@ mod tests { #[cfg(feature = "transport_tcp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_unicast_compression_tcp_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locators let endpoints: Vec = vec![ @@ -446,7 +446,7 @@ mod tests { #[cfg(feature = "transport_tcp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_unicast_compression_tcp_only_with_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locators let endpoints: Vec = vec![format!("tcp/127.0.0.1:{}", 19100).parse().unwrap()]; @@ -468,7 +468,7 @@ mod tests { #[cfg(feature = "transport_udp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_unicast_compression_udp_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locator let endpoints: Vec = vec![ @@ -493,7 +493,7 @@ mod tests { #[cfg(feature = "transport_udp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_unicast_compression_udp_only_with_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locator let endpoints: Vec = vec![format!("udp/127.0.0.1:{}", 19110).parse().unwrap()]; diff --git a/io/zenoh-transport/tests/unicast_concurrent.rs b/io/zenoh-transport/tests/unicast_concurrent.rs index 183f8a7163..ea124e1c05 100644 --- a/io/zenoh-transport/tests/unicast_concurrent.rs +++ b/io/zenoh-transport/tests/unicast_concurrent.rs @@ -347,7 +347,7 @@ async fn transport_concurrent(endpoint01: Vec, endpoint02: Vec = vec![ format!("tcp/127.0.0.1:{}", 9000).parse().unwrap(), @@ -377,7 +377,7 @@ async fn transport_tcp_concurrent() { #[tokio::test] #[ignore] async fn transport_ws_concurrent() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint01: Vec = vec![ format!("ws/127.0.0.1:{}", 9020).parse().unwrap(), @@ -407,7 +407,7 @@ async fn transport_ws_concurrent() { #[tokio::test] #[ignore] async fn transport_unixpipe_concurrent() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint01: Vec = vec![ "unixpipe/transport_unixpipe_concurrent".parse().unwrap(), diff --git a/io/zenoh-transport/tests/unicast_intermittent.rs b/io/zenoh-transport/tests/unicast_intermittent.rs index a2cb1e2d12..9564eeb865 100644 --- a/io/zenoh-transport/tests/unicast_intermittent.rs +++ b/io/zenoh-transport/tests/unicast_intermittent.rs @@ -428,7 +428,7 @@ async fn lowlatency_transport_intermittent(endpoint: &EndPoint) { #[cfg(feature = "transport_tcp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_tcp_intermittent() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("tcp/127.0.0.1:{}", 12000).parse().unwrap(); universal_transport_intermittent(&endpoint).await; } @@ -436,7 +436,7 @@ async fn transport_tcp_intermittent() { #[cfg(feature = "transport_tcp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_tcp_intermittent_for_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("tcp/127.0.0.1:{}", 12100).parse().unwrap(); lowlatency_transport_intermittent(&endpoint).await; } @@ -445,7 +445,7 @@ async fn transport_tcp_intermittent_for_lowlatency_transport() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn transport_ws_intermittent() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("ws/127.0.0.1:{}", 12010).parse().unwrap(); universal_transport_intermittent(&endpoint).await; } @@ -454,7 +454,7 @@ async fn transport_ws_intermittent() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn transport_ws_intermittent_for_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("ws/127.0.0.1:{}", 12110).parse().unwrap(); lowlatency_transport_intermittent(&endpoint).await; } @@ -463,7 +463,7 @@ async fn transport_ws_intermittent_for_lowlatency_transport() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn transport_unixpipe_intermittent() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = "unixpipe/transport_unixpipe_intermittent".parse().unwrap(); universal_transport_intermittent(&endpoint).await; } @@ -472,7 +472,7 @@ async fn transport_unixpipe_intermittent() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn transport_unixpipe_intermittent_for_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = "unixpipe/transport_unixpipe_intermittent_for_lowlatency_transport" .parse() .unwrap(); @@ -482,7 +482,7 @@ async fn transport_unixpipe_intermittent_for_lowlatency_transport() { #[cfg(all(feature = "transport_vsock", target_os = "linux"))] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_vsock_intermittent() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = "vsock/VMADDR_CID_LOCAL:17000".parse().unwrap(); universal_transport_intermittent(&endpoint).await; } diff --git a/io/zenoh-transport/tests/unicast_multilink.rs b/io/zenoh-transport/tests/unicast_multilink.rs index 6fc0864fe2..205de6b007 100644 --- a/io/zenoh-transport/tests/unicast_multilink.rs +++ b/io/zenoh-transport/tests/unicast_multilink.rs @@ -478,7 +478,7 @@ mod tests { #[cfg(feature = "transport_tcp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn multilink_tcp_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("tcp/127.0.0.1:{}", 18000).parse().unwrap(); multilink_transport(&endpoint).await; @@ -487,7 +487,7 @@ mod tests { #[cfg(feature = "transport_udp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn multilink_udp_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("udp/127.0.0.1:{}", 18010).parse().unwrap(); multilink_transport(&endpoint).await; @@ -497,7 +497,7 @@ mod tests { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn multilink_ws_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("ws/127.0.0.1:{}", 18020).parse().unwrap(); multilink_transport(&endpoint).await; @@ -507,7 +507,7 @@ mod tests { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn multilink_unixpipe_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = "unixpipe/multilink_unixpipe_only".parse().unwrap(); multilink_transport(&endpoint).await; @@ -517,7 +517,7 @@ mod tests { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn multilink_unix_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let f1 = "zenoh-test-unix-socket-9.sock"; let _ = std::fs::remove_file(f1); @@ -532,7 +532,7 @@ mod tests { async fn multilink_tls_only() { use zenoh_link::tls::config::*; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // NOTE: this an auto-generated pair of certificate and key. // The target domain is localhost, so it has no real @@ -727,7 +727,7 @@ R+IdLiXcyIkg0m9N8I17p0ljCSkbrgGMD3bbePRTfg== #[cfg(all(feature = "transport_vsock", target_os = "linux"))] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn multilink_vsock_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = "vsock/VMADDR_CID_LOCAL:17000".parse().unwrap(); multilink_transport(&endpoint).await; diff --git a/io/zenoh-transport/tests/unicast_openclose.rs b/io/zenoh-transport/tests/unicast_openclose.rs index 8909d74402..82e3eb600a 100644 --- a/io/zenoh-transport/tests/unicast_openclose.rs +++ b/io/zenoh-transport/tests/unicast_openclose.rs @@ -476,7 +476,7 @@ async fn openclose_lowlatency_transport(endpoint: &EndPoint) { #[cfg(feature = "transport_tcp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn openclose_tcp_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("tcp/127.0.0.1:{}", 13000).parse().unwrap(); openclose_universal_transport(&endpoint).await; } @@ -484,7 +484,7 @@ async fn openclose_tcp_only() { #[cfg(feature = "transport_tcp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn openclose_tcp_only_with_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("tcp/127.0.0.1:{}", 13100).parse().unwrap(); openclose_lowlatency_transport(&endpoint).await; } @@ -492,7 +492,7 @@ async fn openclose_tcp_only_with_lowlatency_transport() { #[cfg(feature = "transport_udp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn openclose_udp_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("udp/127.0.0.1:{}", 13010).parse().unwrap(); openclose_universal_transport(&endpoint).await; } @@ -500,7 +500,7 @@ async fn openclose_udp_only() { #[cfg(feature = "transport_udp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn openclose_udp_only_with_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("udp/127.0.0.1:{}", 13110).parse().unwrap(); openclose_lowlatency_transport(&endpoint).await; } @@ -509,7 +509,7 @@ async fn openclose_udp_only_with_lowlatency_transport() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn openclose_ws_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("ws/127.0.0.1:{}", 13020).parse().unwrap(); openclose_universal_transport(&endpoint).await; } @@ -518,7 +518,7 @@ async fn openclose_ws_only() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn openclose_ws_only_with_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("ws/127.0.0.1:{}", 13120).parse().unwrap(); openclose_lowlatency_transport(&endpoint).await; } @@ -527,7 +527,7 @@ async fn openclose_ws_only_with_lowlatency_transport() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn openclose_unixpipe_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = "unixpipe/openclose_unixpipe_only".parse().unwrap(); openclose_universal_transport(&endpoint).await; } @@ -536,7 +536,7 @@ async fn openclose_unixpipe_only() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn openclose_unixpipe_only_with_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = "unixpipe/openclose_unixpipe_only_with_lowlatency_transport" .parse() .unwrap(); @@ -547,7 +547,7 @@ async fn openclose_unixpipe_only_with_lowlatency_transport() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn openclose_unix_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let f1 = "zenoh-test-unix-socket-9.sock"; let _ = std::fs::remove_file(f1); let endpoint: EndPoint = format!("unixsock-stream/{f1}").parse().unwrap(); @@ -561,7 +561,7 @@ async fn openclose_unix_only() { async fn openclose_tls_only() { use zenoh_link::tls::config::*; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // NOTE: this an auto-generated pair of certificate and key. // The target domain is localhost, so it has no real // mapping to any existing domain. The certificate and key @@ -759,7 +759,7 @@ R+IdLiXcyIkg0m9N8I17p0ljCSkbrgGMD3bbePRTfg== async fn openclose_tcp_only_connect_with_interface_restriction() { let addrs = get_ipv4_ipaddrs(None); - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let listen_endpoint: EndPoint = format!("tcp/{}:{}", addrs[0], 13001).parse().unwrap(); @@ -778,7 +778,7 @@ async fn openclose_tcp_only_connect_with_interface_restriction() { async fn openclose_tcp_only_listen_with_interface_restriction() { let addrs = get_ipv4_ipaddrs(None); - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let listen_endpoint: EndPoint = format!("tcp/{}:{}#iface=lo", addrs[0], 13002) .parse() @@ -797,7 +797,7 @@ async fn openclose_tcp_only_listen_with_interface_restriction() { async fn openclose_udp_only_connect_with_interface_restriction() { let addrs = get_ipv4_ipaddrs(None); - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let listen_endpoint: EndPoint = format!("udp/{}:{}", addrs[0], 13003).parse().unwrap(); @@ -816,7 +816,7 @@ async fn openclose_udp_only_connect_with_interface_restriction() { async fn openclose_udp_only_listen_with_interface_restriction() { let addrs = get_ipv4_ipaddrs(None); - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let listen_endpoint: EndPoint = format!("udp/{}:{}#iface=lo", addrs[0], 13004) .parse() .unwrap(); @@ -830,7 +830,7 @@ async fn openclose_udp_only_listen_with_interface_restriction() { #[cfg(all(feature = "transport_vsock", target_os = "linux"))] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn openclose_vsock() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = "vsock/VMADDR_CID_LOCAL:17000".parse().unwrap(); openclose_lowlatency_transport(&endpoint).await; } diff --git a/io/zenoh-transport/tests/unicast_priorities.rs b/io/zenoh-transport/tests/unicast_priorities.rs index 708a9fad3b..d71cc845cc 100644 --- a/io/zenoh-transport/tests/unicast_priorities.rs +++ b/io/zenoh-transport/tests/unicast_priorities.rs @@ -333,7 +333,7 @@ async fn run(endpoints: &[EndPoint]) { #[cfg(feature = "transport_tcp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn priorities_tcp_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locators let endpoints: Vec = vec![format!("tcp/127.0.0.1:{}", 10000).parse().unwrap()]; // Run @@ -344,7 +344,7 @@ async fn priorities_tcp_only() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn conduits_unixpipe_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locators let endpoints: Vec = vec!["unixpipe/conduits_unixpipe_only" .to_string() @@ -357,7 +357,7 @@ async fn conduits_unixpipe_only() { #[cfg(feature = "transport_ws")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn priorities_ws_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locators let endpoints: Vec = vec![format!("ws/127.0.0.1:{}", 10010).parse().unwrap()]; // Run diff --git a/io/zenoh-transport/tests/unicast_shm.rs b/io/zenoh-transport/tests/unicast_shm.rs index 8c06a17f6d..3310046736 100644 --- a/io/zenoh-transport/tests/unicast_shm.rs +++ b/io/zenoh-transport/tests/unicast_shm.rs @@ -360,7 +360,7 @@ mod tests { #[cfg(feature = "transport_tcp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_tcp_shm() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("tcp/127.0.0.1:{}", 14000).parse().unwrap(); run(&endpoint, false).await; } @@ -368,7 +368,7 @@ mod tests { #[cfg(feature = "transport_tcp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_tcp_shm_with_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("tcp/127.0.0.1:{}", 14001).parse().unwrap(); run(&endpoint, true).await; } @@ -376,7 +376,7 @@ mod tests { #[cfg(feature = "transport_ws")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_ws_shm() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("ws/127.0.0.1:{}", 14010).parse().unwrap(); run(&endpoint, false).await; } @@ -384,7 +384,7 @@ mod tests { #[cfg(feature = "transport_ws")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_ws_shm_with_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("ws/127.0.0.1:{}", 14011).parse().unwrap(); run(&endpoint, true).await; } @@ -392,7 +392,7 @@ mod tests { #[cfg(feature = "transport_unixpipe")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_unixpipe_shm() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = "unixpipe/transport_unixpipe_shm".parse().unwrap(); run(&endpoint, false).await; } @@ -400,7 +400,7 @@ mod tests { #[cfg(feature = "transport_unixpipe")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_unixpipe_shm_with_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = "unixpipe/transport_unixpipe_shm_with_lowlatency_transport" .parse() .unwrap(); diff --git a/io/zenoh-transport/tests/unicast_simultaneous.rs b/io/zenoh-transport/tests/unicast_simultaneous.rs index 4f529c3b74..248ff2ef53 100644 --- a/io/zenoh-transport/tests/unicast_simultaneous.rs +++ b/io/zenoh-transport/tests/unicast_simultaneous.rs @@ -304,7 +304,7 @@ mod tests { #[cfg(feature = "transport_tcp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_tcp_simultaneous() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint01: Vec = vec![ format!("tcp/127.0.0.1:{}", 15000).parse().unwrap(), format!("tcp/127.0.0.1:{}", 15001).parse().unwrap(), @@ -325,7 +325,7 @@ mod tests { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn transport_unixpipe_simultaneous() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint01: Vec = vec![ "unixpipe/transport_unixpipe_simultaneous".parse().unwrap(), "unixpipe/transport_unixpipe_simultaneous2".parse().unwrap(), @@ -346,7 +346,7 @@ mod tests { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn transport_ws_simultaneous() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint01: Vec = vec![ format!("ws/127.0.0.1:{}", 15020).parse().unwrap(), diff --git a/io/zenoh-transport/tests/unicast_time.rs b/io/zenoh-transport/tests/unicast_time.rs index 5c62235371..95e455006b 100644 --- a/io/zenoh-transport/tests/unicast_time.rs +++ b/io/zenoh-transport/tests/unicast_time.rs @@ -231,7 +231,7 @@ async fn time_lowlatency_transport(endpoint: &EndPoint) { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn time_tcp_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("tcp/127.0.0.1:{}", 13000).parse().unwrap(); time_universal_transport(&endpoint).await; } @@ -240,7 +240,7 @@ async fn time_tcp_only() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn time_tcp_only_with_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("tcp/127.0.0.1:{}", 13100).parse().unwrap(); time_lowlatency_transport(&endpoint).await; } @@ -249,7 +249,7 @@ async fn time_tcp_only_with_lowlatency_transport() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn time_udp_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("udp/127.0.0.1:{}", 13010).parse().unwrap(); time_universal_transport(&endpoint).await; } @@ -258,7 +258,7 @@ async fn time_udp_only() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn time_udp_only_with_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("udp/127.0.0.1:{}", 13110).parse().unwrap(); time_lowlatency_transport(&endpoint).await; } @@ -267,7 +267,7 @@ async fn time_udp_only_with_lowlatency_transport() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn time_ws_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("ws/127.0.0.1:{}", 13020).parse().unwrap(); time_universal_transport(&endpoint).await; } @@ -276,7 +276,7 @@ async fn time_ws_only() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn time_ws_only_with_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = format!("ws/127.0.0.1:{}", 13120).parse().unwrap(); time_lowlatency_transport(&endpoint).await; } @@ -285,7 +285,7 @@ async fn time_ws_only_with_lowlatency_transport() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn time_unixpipe_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = "unixpipe/time_unixpipe_only".parse().unwrap(); time_universal_transport(&endpoint).await; } @@ -294,7 +294,7 @@ async fn time_unixpipe_only() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn time_unixpipe_only_with_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = "unixpipe/time_unixpipe_only_with_lowlatency_transport" .parse() .unwrap(); @@ -305,7 +305,7 @@ async fn time_unixpipe_only_with_lowlatency_transport() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn time_unix_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let f1 = "zenoh-test-unix-socket-9.sock"; let _ = std::fs::remove_file(f1); let endpoint: EndPoint = format!("unixsock-stream/{f1}").parse().unwrap(); @@ -319,7 +319,7 @@ async fn time_unix_only() { #[ignore] async fn time_tls_only() { use zenoh_link::tls::config::*; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // NOTE: this an auto-generated pair of certificate and key. // The target domain is localhost, so it has no real // mapping to any existing domain. The certificate and key @@ -515,7 +515,7 @@ R+IdLiXcyIkg0m9N8I17p0ljCSkbrgGMD3bbePRTfg== #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn time_vsock_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let endpoint: EndPoint = "vsock/VMADDR_CID_LOCAL:17000".parse().unwrap(); time_lowlatency_transport(&endpoint).await; } diff --git a/io/zenoh-transport/tests/unicast_transport.rs b/io/zenoh-transport/tests/unicast_transport.rs index 1c5d749b59..5a414d664d 100644 --- a/io/zenoh-transport/tests/unicast_transport.rs +++ b/io/zenoh-transport/tests/unicast_transport.rs @@ -605,7 +605,7 @@ async fn run_with_lowlatency_transport( #[cfg(feature = "transport_tcp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_unicast_tcp_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locators let endpoints: Vec = vec![ @@ -630,7 +630,7 @@ async fn transport_unicast_tcp_only() { #[cfg(feature = "transport_tcp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_unicast_tcp_only_with_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locators let endpoints: Vec = vec![format!("tcp/127.0.0.1:{}", 16100).parse().unwrap()]; @@ -652,7 +652,7 @@ async fn transport_unicast_tcp_only_with_lowlatency_transport() { #[cfg(feature = "transport_udp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_unicast_udp_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locator let endpoints: Vec = vec![ @@ -677,7 +677,7 @@ async fn transport_unicast_udp_only() { #[cfg(feature = "transport_udp")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_unicast_udp_only_with_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locator let endpoints: Vec = vec![format!("udp/127.0.0.1:{}", 16110).parse().unwrap()]; @@ -699,7 +699,7 @@ async fn transport_unicast_udp_only_with_lowlatency_transport() { #[cfg(all(feature = "transport_unixsock-stream", target_family = "unix"))] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_unicast_unix_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let f1 = "zenoh-test-unix-socket-5.sock"; let _ = std::fs::remove_file(f1); @@ -725,7 +725,7 @@ async fn transport_unicast_unix_only() { #[cfg(all(feature = "transport_unixsock-stream", target_family = "unix"))] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_unicast_unix_only_with_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let f1 = "zenoh-test-unix-socket-5-lowlatency.sock"; let _ = std::fs::remove_file(f1); @@ -751,7 +751,7 @@ async fn transport_unicast_unix_only_with_lowlatency_transport() { #[cfg(feature = "transport_ws")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_unicast_ws_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locators let endpoints: Vec = vec![ @@ -784,7 +784,7 @@ async fn transport_unicast_ws_only() { #[cfg(feature = "transport_ws")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_unicast_ws_only_with_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locators let endpoints: Vec = vec![format!("ws/127.0.0.1:{}", 16120).parse().unwrap()]; @@ -814,7 +814,7 @@ async fn transport_unicast_ws_only_with_lowlatency_transport() { #[cfg(feature = "transport_unixpipe")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_unicast_unixpipe_only() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locator let endpoints: Vec = vec![ @@ -839,7 +839,7 @@ async fn transport_unicast_unixpipe_only() { #[cfg(feature = "transport_unixpipe")] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_unicast_unixpipe_only_with_lowlatency_transport() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locator let endpoints: Vec = vec![ @@ -865,7 +865,7 @@ async fn transport_unicast_unixpipe_only_with_lowlatency_transport() { #[cfg(all(feature = "transport_tcp", feature = "transport_udp"))] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_unicast_tcp_udp() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locator let endpoints: Vec = vec![ @@ -896,7 +896,7 @@ async fn transport_unicast_tcp_udp() { ))] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_unicast_tcp_unix() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let f1 = "zenoh-test-unix-socket-6.sock"; let _ = std::fs::remove_file(f1); @@ -930,7 +930,7 @@ async fn transport_unicast_tcp_unix() { ))] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_unicast_udp_unix() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let f1 = "zenoh-test-unix-socket-7.sock"; let _ = std::fs::remove_file(f1); @@ -965,7 +965,7 @@ async fn transport_unicast_udp_unix() { ))] #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn transport_unicast_tcp_udp_unix() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let f1 = "zenoh-test-unix-socket-8.sock"; let _ = std::fs::remove_file(f1); @@ -999,7 +999,7 @@ async fn transport_unicast_tcp_udp_unix() { async fn transport_unicast_tls_only_server() { use zenoh_link::tls::config::*; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locator let mut endpoint: EndPoint = format!("tls/localhost:{}", 16070).parse().unwrap(); @@ -1045,7 +1045,7 @@ async fn transport_unicast_tls_only_server() { async fn transport_unicast_quic_only_server() { use zenoh_link::quic::config::*; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locator let mut endpoint: EndPoint = format!("quic/localhost:{}", 16080).parse().unwrap(); endpoint @@ -1090,7 +1090,7 @@ async fn transport_unicast_quic_only_server() { async fn transport_unicast_tls_only_mutual_success() { use zenoh_link::tls::config::*; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let client_auth = "true"; @@ -1163,7 +1163,7 @@ async fn transport_unicast_tls_only_mutual_no_client_certs_failure() { use zenoh_link::tls::config::*; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locator let mut client_endpoint: EndPoint = ("tls/localhost:10462").parse().unwrap(); @@ -1227,7 +1227,7 @@ async fn transport_unicast_tls_only_mutual_no_client_certs_failure() { fn transport_unicast_tls_only_mutual_wrong_client_certs_failure() { use zenoh_link::tls::config::*; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let client_auth = "true"; @@ -1306,7 +1306,7 @@ fn transport_unicast_tls_only_mutual_wrong_client_certs_failure() { async fn transport_unicast_quic_only_mutual_success() { use zenoh_link::quic::config::*; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let client_auth = "true"; @@ -1379,7 +1379,7 @@ async fn transport_unicast_quic_only_mutual_no_client_certs_failure() { use zenoh_link::quic::config::*; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // Define the locator let mut client_endpoint: EndPoint = ("quic/localhost:10462").parse().unwrap(); @@ -1443,7 +1443,7 @@ async fn transport_unicast_quic_only_mutual_no_client_certs_failure() { fn transport_unicast_quic_only_mutual_wrong_client_certs_failure() { use zenoh_link::quic::config::*; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let client_auth = "true"; diff --git a/plugins/zenoh-plugin-example/src/lib.rs b/plugins/zenoh-plugin-example/src/lib.rs index b7c494946d..aa943c12e3 100644 --- a/plugins/zenoh-plugin-example/src/lib.rs +++ b/plugins/zenoh-plugin-example/src/lib.rs @@ -173,7 +173,7 @@ impl Drop for RunningPlugin { } async fn run(runtime: Runtime, selector: KeyExpr<'_>, flag: Arc) { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); // create a zenoh Session that shares the same Runtime than zenohd let session = zenoh::session::init(runtime).await.unwrap(); diff --git a/plugins/zenoh-plugin-rest/examples/z_serve_sse.rs b/plugins/zenoh-plugin-rest/examples/z_serve_sse.rs index 161e647457..849800de73 100644 --- a/plugins/zenoh-plugin-rest/examples/z_serve_sse.rs +++ b/plugins/zenoh-plugin-rest/examples/z_serve_sse.rs @@ -34,7 +34,7 @@ if(typeof(EventSource) !== "undefined") { #[tokio::main] async fn main() { // initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let config = parse_args(); let key = keyexpr::new("demo/sse").unwrap(); diff --git a/plugins/zenoh-plugin-rest/src/lib.rs b/plugins/zenoh-plugin-rest/src/lib.rs index 7ed44ebe2f..f0d1cc65f0 100644 --- a/plugins/zenoh-plugin-rest/src/lib.rs +++ b/plugins/zenoh-plugin-rest/src/lib.rs @@ -272,7 +272,7 @@ impl Plugin for RestPlugin { // Try to initiate login. // Required in case of dynamic lib, otherwise no logs. // But cannot be done twice in case of static link. - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); tracing::debug!("REST plugin {}", LONG_VERSION.as_str()); let runtime_conf = runtime.config().lock(); @@ -510,7 +510,7 @@ pub async fn run(runtime: Runtime, conf: Config) -> ZResult<()> { // Try to initiate login. // Required in case of dynamic lib, otherwise no logs. // But cannot be done twice in case of static link. - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let zid = runtime.zid().to_string(); let session = zenoh::session::init(runtime).await.unwrap(); diff --git a/plugins/zenoh-plugin-storage-manager/src/lib.rs b/plugins/zenoh-plugin-storage-manager/src/lib.rs index 77e53cc80d..c683f1b2e4 100644 --- a/plugins/zenoh-plugin-storage-manager/src/lib.rs +++ b/plugins/zenoh-plugin-storage-manager/src/lib.rs @@ -82,7 +82,7 @@ impl Plugin for StoragesPlugin { type Instance = RunningPlugin; fn start(name: &str, runtime: &Self::StartArgs) -> ZResult { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); tracing::debug!("StorageManager plugin {}", Self::PLUGIN_VERSION); let config = { PluginConfig::try_from((name, runtime.config().lock().plugin(name).unwrap())) }?; @@ -116,7 +116,7 @@ impl StorageRuntimeInner { // Try to initiate login. // Required in case of dynamic lib, otherwise no logs. // But cannot be done twice in case of static link. - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let PluginConfig { name, backend_search_dirs, diff --git a/zenoh-ext/examples/examples/z_member.rs b/zenoh-ext/examples/examples/z_member.rs index 90129ca21e..aee0a5b5e8 100644 --- a/zenoh-ext/examples/examples/z_member.rs +++ b/zenoh-ext/examples/examples/z_member.rs @@ -19,7 +19,7 @@ use zenoh_ext::group::*; #[tokio::main] async fn main() { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let z = Arc::new(zenoh::open(Config::default()).await.unwrap()); let member = Member::new(z.zid().to_string()) .unwrap() diff --git a/zenoh-ext/examples/examples/z_pub_cache.rs b/zenoh-ext/examples/examples/z_pub_cache.rs index ae4a73112b..6c47fb0862 100644 --- a/zenoh-ext/examples/examples/z_pub_cache.rs +++ b/zenoh-ext/examples/examples/z_pub_cache.rs @@ -24,7 +24,7 @@ use zenoh_ext_examples::CommonArgs; #[tokio::main] async fn main() { // Initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, key_expr, value, history, prefix, complete) = parse_args(); diff --git a/zenoh-ext/examples/examples/z_query_sub.rs b/zenoh-ext/examples/examples/z_query_sub.rs index c819a2a831..0931d289fe 100644 --- a/zenoh-ext/examples/examples/z_query_sub.rs +++ b/zenoh-ext/examples/examples/z_query_sub.rs @@ -19,7 +19,7 @@ use zenoh_ext_examples::CommonArgs; #[tokio::main] async fn main() { // Initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, key_expr, query) = parse_args(); diff --git a/zenoh-ext/examples/examples/z_view_size.rs b/zenoh-ext/examples/examples/z_view_size.rs index a38120cfb4..79eb5bd3c1 100644 --- a/zenoh-ext/examples/examples/z_view_size.rs +++ b/zenoh-ext/examples/examples/z_view_size.rs @@ -20,7 +20,7 @@ use zenoh_ext_examples::CommonArgs; #[tokio::main] async fn main() { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (config, group_name, id, size, timeout) = parse_args(); diff --git a/zenoh-ext/tests/liveliness.rs b/zenoh-ext/tests/liveliness.rs index 637d07ba57..b1c231006d 100644 --- a/zenoh-ext/tests/liveliness.rs +++ b/zenoh-ext/tests/liveliness.rs @@ -32,7 +32,7 @@ async fn test_liveliness_querying_subscriber_clique() { const LIVELINESS_KEYEXPR_2: &str = "test/liveliness/querying-subscriber/brokered/2"; const LIVELINESS_KEYEXPR_ALL: &str = "test/liveliness/querying-subscriber/brokered/*"; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let peer1 = { let mut c = config::default(); @@ -110,7 +110,7 @@ async fn test_liveliness_querying_subscriber_brokered() { const LIVELINESS_KEYEXPR_2: &str = "test/liveliness/querying-subscriber/brokered/2"; const LIVELINESS_KEYEXPR_ALL: &str = "test/liveliness/querying-subscriber/brokered/*"; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let router = { let mut c = config::default(); @@ -216,7 +216,7 @@ async fn test_liveliness_fetching_subscriber_clique() { const LIVELINESS_KEYEXPR_2: &str = "test/liveliness/querying-subscriber/brokered/2"; const LIVELINESS_KEYEXPR_ALL: &str = "test/liveliness/querying-subscriber/brokered/*"; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let peer1 = { let mut c = config::default(); @@ -298,7 +298,7 @@ async fn test_liveliness_fetching_subscriber_brokered() { const LIVELINESS_KEYEXPR_2: &str = "test/liveliness/querying-subscriber/brokered/2"; const LIVELINESS_KEYEXPR_ALL: &str = "test/liveliness/querying-subscriber/brokered/*"; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let router = { let mut c = config::default(); diff --git a/zenoh/src/net/runtime/orchestrator.rs b/zenoh/src/net/runtime/orchestrator.rs index 6fc110c3a6..fee4c86c1d 100644 --- a/zenoh/src/net/runtime/orchestrator.rs +++ b/zenoh/src/net/runtime/orchestrator.rs @@ -299,17 +299,13 @@ impl Runtime { self.connect_peers_impl(peers, single_link).await } else { let res = tokio::time::timeout(timeout, async { - self.connect_peers_impl(peers, single_link).await.ok() + self.connect_peers_impl(peers, single_link).await }) .await; match res { - Ok(_) => Ok(()), + Ok(r) => r, Err(_) => { - let e = zerror!( - "{:?} Unable to connect to any of {:?}! ", - self.manager().get_locators(), - peers - ); + let e = zerror!("Unable to connect to any of {:?}. Timeout!", peers); tracing::error!("{}", &e); Err(e.into()) } @@ -381,7 +377,10 @@ impl Runtime { let _ = self.peer_connector_retry(endpoint).await; } else { // try to connect in background - self.spawn_peer_connector(endpoint).await? + if let Err(e) = self.spawn_peer_connector(endpoint.clone()).await { + tracing::error!("Error connecting to {}: {}", endpoint, e); + return Err(e); + } } } Ok(()) diff --git a/zenoh/tests/acl.rs b/zenoh/tests/acl.rs index 13104338b7..2505a81983 100644 --- a/zenoh/tests/acl.rs +++ b/zenoh/tests/acl.rs @@ -35,7 +35,7 @@ mod test { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_acl_pub_sub() { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); test_pub_sub_deny(27447).await; test_pub_sub_allow(27447).await; test_pub_sub_deny_then_allow(27447).await; @@ -44,7 +44,7 @@ mod test { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_acl_get_queryable() { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); test_get_qbl_deny(27448).await; test_get_qbl_allow(27448).await; test_get_qbl_allow_then_deny(27448).await; @@ -53,7 +53,7 @@ mod test { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_acl_queryable_reply() { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); // Only test cases not covered by `test_acl_get_queryable` test_reply_deny(27449).await; test_reply_allow_then_deny(27449).await; diff --git a/zenoh/tests/authentication.rs b/zenoh/tests/authentication.rs index fcd448f7d1..f9fb7a3b0e 100644 --- a/zenoh/tests/authentication.rs +++ b/zenoh/tests/authentication.rs @@ -38,7 +38,7 @@ mod test { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_authentication_usrpwd() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); create_new_files(TESTFILES_PATH.to_path_buf()) .await .unwrap(); @@ -50,7 +50,7 @@ mod test { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_authentication_tls() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); create_new_files(TESTFILES_PATH.to_path_buf()) .await .unwrap(); @@ -62,7 +62,7 @@ mod test { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_authentication_quic() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); create_new_files(TESTFILES_PATH.to_path_buf()) .await .unwrap(); @@ -75,7 +75,7 @@ mod test { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_authentication_lowlatency() { // Test link AuthIds accessibility for lowlatency transport - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); create_new_files(TESTFILES_PATH.to_path_buf()) .await .unwrap(); @@ -84,7 +84,7 @@ mod test { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_authentication_subject_combinations() { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); create_new_files(TESTFILES_PATH.to_path_buf()) .await .unwrap(); diff --git a/zenoh/tests/interceptors.rs b/zenoh/tests/interceptors.rs index 1e5ef13799..1f3981b66e 100644 --- a/zenoh/tests/interceptors.rs +++ b/zenoh/tests/interceptors.rs @@ -192,7 +192,7 @@ fn downsampling_by_keyexpr_impl(flow: InterceptorFlow) { #[test] fn downsampling_by_keyexpr() { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); downsampling_by_keyexpr_impl(InterceptorFlow::Ingress); downsampling_by_keyexpr_impl(InterceptorFlow::Egress); } @@ -245,7 +245,7 @@ fn downsampling_by_interface_impl(flow: InterceptorFlow) { #[cfg(unix)] #[test] fn downsampling_by_interface() { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); downsampling_by_interface_impl(InterceptorFlow::Ingress); downsampling_by_interface_impl(InterceptorFlow::Egress); } @@ -253,7 +253,7 @@ fn downsampling_by_interface() { #[test] #[should_panic(expected = "unknown variant `down`")] fn downsampling_config_error_wrong_strategy() { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let mut config = Config::default(); config diff --git a/zenoh/tests/liveliness.rs b/zenoh/tests/liveliness.rs index 4d964cc1cf..3f1d38af23 100644 --- a/zenoh/tests/liveliness.rs +++ b/zenoh/tests/liveliness.rs @@ -27,7 +27,7 @@ async fn test_liveliness_subscriber_clique() { const PEER1_ENDPOINT: &str = "tcp/localhost:47447"; const LIVELINESS_KEYEXPR: &str = "test/liveliness/subscriber/clique"; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let peer1 = { let mut c = config::default(); @@ -91,7 +91,7 @@ async fn test_liveliness_query_clique() { const PEER1_ENDPOINT: &str = "tcp/localhost:47448"; const LIVELINESS_KEYEXPR: &str = "test/liveliness/query/clique"; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let peer1 = { let mut c = config::default(); @@ -149,7 +149,7 @@ async fn test_liveliness_subscriber_brokered() { const ROUTER_ENDPOINT: &str = "tcp/localhost:47449"; const LIVELINESS_KEYEXPR: &str = "test/liveliness/subscriber/brokered"; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let router = { let mut c = config::default(); @@ -227,7 +227,7 @@ async fn test_liveliness_query_brokered() { const ROUTER_ENDPOINT: &str = "tcp/localhost:47450"; const LIVELINESS_KEYEXPR: &str = "test/liveliness/query/brokered"; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let router = { let mut c = config::default(); @@ -296,7 +296,7 @@ async fn test_liveliness_subscriber_local() { const SLEEP: Duration = Duration::from_secs(1); const LIVELINESS_KEYEXPR: &str = "test/liveliness/subscriber/local"; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let peer = { let mut c = config::default(); @@ -339,7 +339,7 @@ async fn test_liveliness_query_local() { const SLEEP: Duration = Duration::from_secs(1); const LIVELINESS_KEYEXPR: &str = "test/liveliness/query/local"; - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let peer = { let mut c = config::default(); diff --git a/zenoh/tests/matching.rs b/zenoh/tests/matching.rs index da0ba0a6d1..b2a180552d 100644 --- a/zenoh/tests/matching.rs +++ b/zenoh/tests/matching.rs @@ -41,7 +41,7 @@ async fn create_session_pair(locator: &str) -> (Session, Session) { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn zenoh_matching_status_any() -> ZResult<()> { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let (session1, session2) = create_session_pair("tcp/127.0.0.1:18001").await; let publisher1 = ztimeout!(session1 @@ -93,7 +93,7 @@ async fn zenoh_matching_status_any() -> ZResult<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn zenoh_matching_status_remote() -> ZResult<()> { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let session1 = ztimeout!(zenoh::open(config::peer())).unwrap(); let session2 = ztimeout!(zenoh::open(config::peer())).unwrap(); @@ -148,7 +148,7 @@ async fn zenoh_matching_status_remote() -> ZResult<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn zenoh_matching_status_local() -> ZResult<()> { - zenoh_util::try_init_log_from_env(); + zenoh_util::init_log_from_env_or("error"); let session1 = ztimeout!(zenoh::open(zenoh::config::peer())).unwrap(); let session2 = ztimeout!(zenoh::open(zenoh::config::peer())).unwrap(); diff --git a/zenoh/tests/open_time.rs b/zenoh/tests/open_time.rs index 7f1c2b2972..98714c39c5 100644 --- a/zenoh/tests/open_time.rs +++ b/zenoh/tests/open_time.rs @@ -138,7 +138,7 @@ async fn time_lowlatency_open(endpoint: &EndPoint, mode: WhatAmI) { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn time_tcp_only_open() { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let endpoint: EndPoint = format!("tcp/127.0.0.1:{}", 14000).parse().unwrap(); time_universal_open(&endpoint, WhatAmI::Client).await; } @@ -147,7 +147,7 @@ async fn time_tcp_only_open() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn time_tcp_only_with_lowlatency_open() { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let endpoint: EndPoint = format!("tcp/127.0.0.1:{}", 14100).parse().unwrap(); time_lowlatency_open(&endpoint, WhatAmI::Client).await; } @@ -156,7 +156,7 @@ async fn time_tcp_only_with_lowlatency_open() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn time_udp_only_open() { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let endpoint: EndPoint = format!("udp/127.0.0.1:{}", 14010).parse().unwrap(); time_universal_open(&endpoint, WhatAmI::Client).await; } @@ -165,7 +165,7 @@ async fn time_udp_only_open() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn time_udp_only_with_lowlatency_open() { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let endpoint: EndPoint = format!("udp/127.0.0.1:{}", 14110).parse().unwrap(); time_lowlatency_open(&endpoint, WhatAmI::Client).await; } @@ -174,7 +174,7 @@ async fn time_udp_only_with_lowlatency_open() { // #[tokio::test(flavor = "multi_thread", worker_threads = 4)] // #[ignore] // async fn time_ws_only_open() { -// zenoh::try_init_log_from_env(); +// zenoh::init_log_from_env_or("error"); // let endpoint: EndPoint = format!("ws/127.0.0.1:{}", 14020).parse().unwrap(); // time_universal_open(&endpoint, WhatAmI::Client).await; // } @@ -183,7 +183,7 @@ async fn time_udp_only_with_lowlatency_open() { // #[tokio::test(flavor = "multi_thread", worker_threads = 4)] // #[ignore] // async fn time_ws_only_with_lowlatency_open() { -// zenoh::try_init_log_from_env(); +// zenoh::init_log_from_env_or("error"); // let endpoint: EndPoint = format!("ws/127.0.0.1:{}", 14120).parse().unwrap(); // time_lowlatency_open(&endpoint, WhatAmI::Client).await; // } @@ -192,7 +192,7 @@ async fn time_udp_only_with_lowlatency_open() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn time_unixpipe_only_open() { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let endpoint: EndPoint = "unixpipe/time_unixpipe_only_open".parse().unwrap(); time_universal_open(&endpoint, WhatAmI::Client).await; } @@ -201,7 +201,7 @@ async fn time_unixpipe_only_open() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn time_unixpipe_only_with_lowlatency_open() { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let endpoint: EndPoint = "unixpipe/time_unixpipe_only_with_lowlatency_open" .parse() .unwrap(); @@ -212,7 +212,7 @@ async fn time_unixpipe_only_with_lowlatency_open() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn time_unix_only_open() { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let f1 = "zenoh-test-unix-socket-9-open.sock"; let _ = std::fs::remove_file(f1); let endpoint: EndPoint = format!("unixsock-stream/{f1}").parse().unwrap(); @@ -227,7 +227,7 @@ async fn time_unix_only_open() { async fn time_tls_only_open() { use zenoh_link::tls::config::*; - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); // NOTE: this an auto-generated pair of certificate and key. // The target domain is localhost, so it has no real // mapping to any existing domain. The certificate and key @@ -423,7 +423,7 @@ R+IdLiXcyIkg0m9N8I17p0ljCSkbrgGMD3bbePRTfg== #[tokio::test(flavor = "multi_thread", worker_threads = 4)] #[ignore] async fn time_vsock_only_open() { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let endpoint: EndPoint = "vsock/VMADDR_CID_LOCAL:18000".parse().unwrap(); time_lowlatency_open(&endpoint, WhatAmI::Client).await; } diff --git a/zenoh/tests/routing.rs b/zenoh/tests/routing.rs index 07971b7853..0c4c0b42f1 100644 --- a/zenoh/tests/routing.rs +++ b/zenoh/tests/routing.rs @@ -461,7 +461,7 @@ impl Recipe { // And the message transmission should work even if the common node disappears after a while. #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn gossip() -> Result<()> { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let locator = String::from("tcp/127.0.0.1:17446"); let ke = String::from("testKeyExprGossip"); @@ -529,7 +529,7 @@ async fn gossip() -> Result<()> { // Simulate two peers connecting to a router but not directly reachable to each other can exchange messages via the brokering by the router. #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn static_failover_brokering() -> Result<()> { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let locator = String::from("tcp/127.0.0.1:17449"); let ke = String::from("testKeyExprStaticFailoverBrokering"); let msg_size = 8; @@ -597,7 +597,7 @@ const PARALLEL_RECIPES: usize = 4; #[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 9)] async fn three_node_combination() -> Result<()> { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let modes = [WhatAmI::Peer, WhatAmI::Client]; let delay_in_secs = [ (0, 1, 2), @@ -774,7 +774,7 @@ async fn three_node_combination() -> Result<()> { #[cfg(feature = "unstable")] #[tokio::test(flavor = "multi_thread", worker_threads = 8)] async fn two_node_combination() -> Result<()> { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); #[derive(Clone, Copy)] struct IsFirstListen(bool); diff --git a/zenoh/tests/session.rs b/zenoh/tests/session.rs index 7515eefc49..1195bd2099 100644 --- a/zenoh/tests/session.rs +++ b/zenoh/tests/session.rs @@ -269,7 +269,7 @@ async fn test_session_qryrep(peer01: &Session, peer02: &Session, reliability: Re #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn zenoh_session_unicast() { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (peer01, peer02) = open_session_unicast(&["tcp/127.0.0.1:17447"]).await; test_session_pubsub(&peer01, &peer02, Reliability::Reliable).await; test_session_qryrep(&peer01, &peer02, Reliability::Reliable).await; @@ -278,7 +278,7 @@ async fn zenoh_session_unicast() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn zenoh_session_multicast() { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (peer01, peer02) = open_session_multicast("udp/224.0.0.1:17448", "udp/224.0.0.1:17448").await; test_session_pubsub(&peer01, &peer02, Reliability::BestEffort).await; diff --git a/zenoh/tests/shm.rs b/zenoh/tests/shm.rs index 0febac2eaa..3d5e785e1b 100644 --- a/zenoh/tests/shm.rs +++ b/zenoh/tests/shm.rs @@ -199,7 +199,7 @@ async fn test_session_pubsub(peer01: &Session, peer02: &Session, reliability: Re fn zenoh_shm_unicast() { tokio::runtime::Runtime::new().unwrap().block_on(async { // Initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (peer01, peer02) = open_session_unicast(&["tcp/127.0.0.1:19447"]).await; test_session_pubsub(&peer01, &peer02, Reliability::Reliable).await; @@ -211,7 +211,7 @@ fn zenoh_shm_unicast() { fn zenoh_shm_multicast() { tokio::runtime::Runtime::new().unwrap().block_on(async { // Initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (peer01, peer02) = open_session_multicast("udp/224.0.0.1:19448", "udp/224.0.0.1:19448").await; diff --git a/zenoh/tests/unicity.rs b/zenoh/tests/unicity.rs index 49663249ad..5163420131 100644 --- a/zenoh/tests/unicity.rs +++ b/zenoh/tests/unicity.rs @@ -277,7 +277,7 @@ async fn test_unicity_qryrep(s01: &Session, s02: &Session, s03: &Session) { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn zenoh_unicity_p2p() { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let (s01, s02, s03) = open_p2p_sessions().await; test_unicity_pubsub(&s01, &s02, &s03).await; @@ -287,7 +287,7 @@ async fn zenoh_unicity_p2p() { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn zenoh_unicity_brokered() { - zenoh::try_init_log_from_env(); + zenoh::init_log_from_env_or("error"); let r = open_router_session().await; let (s01, s02, s03) = open_client_sessions().await;