From 99dbc4c27f707dd7c8c39e3438406b99a7bf0d85 Mon Sep 17 00:00:00 2001 From: Joseph Perez Date: Tue, 18 Jun 2024 11:39:36 +0200 Subject: [PATCH] feat: rename `zenoh::try_init_log_from_env` to `zenoh::init_logging` --- examples/examples/z_alloc_shm.rs | 2 +- examples/examples/z_delete.rs | 2 +- examples/examples/z_forward.rs | 2 +- examples/examples/z_get.rs | 2 +- examples/examples/z_get_liveliness.rs | 2 +- examples/examples/z_get_shm.rs | 2 +- examples/examples/z_info.rs | 2 +- examples/examples/z_liveliness.rs | 2 +- examples/examples/z_ping.rs | 2 +- examples/examples/z_ping_shm.rs | 2 +- examples/examples/z_pong.rs | 2 +- examples/examples/z_pub.rs | 2 +- examples/examples/z_pub_shm.rs | 2 +- examples/examples/z_pub_shm_thr.rs | 2 +- examples/examples/z_pub_thr.rs | 2 +- examples/examples/z_pull.rs | 2 +- examples/examples/z_put.rs | 2 +- examples/examples/z_put_float.rs | 2 +- examples/examples/z_queryable.rs | 2 +- examples/examples/z_queryable_shm.rs | 2 +- examples/examples/z_scout.rs | 2 +- examples/examples/z_storage.rs | 2 +- examples/examples/z_sub.rs | 2 +- examples/examples/z_sub_liveliness.rs | 2 +- examples/examples/z_sub_shm.rs | 2 +- examples/examples/z_sub_thr.rs | 2 +- zenoh/src/lib.rs | 20 ++++++++++++-------- zenoh/tests/acl.rs | 2 +- zenoh/tests/interceptors.rs | 6 +++--- zenoh/tests/matching.rs | 6 +++--- zenoh/tests/open_time.rs | 22 +++++++++++----------- zenoh/tests/routing.rs | 8 ++++---- zenoh/tests/session.rs | 4 ++-- zenoh/tests/shm.rs | 4 ++-- zenoh/tests/unicity.rs | 4 ++-- 35 files changed, 66 insertions(+), 62 deletions(-) diff --git a/examples/examples/z_alloc_shm.rs b/examples/examples/z_alloc_shm.rs index 1beabaebd8..44af34196e 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_logging(); run().await.unwrap() } diff --git a/examples/examples/z_delete.rs b/examples/examples/z_delete.rs index 090aadac48..037309c614 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_logging(); let (config, key_expr) = parse_args(); diff --git a/examples/examples/z_forward.rs b/examples/examples/z_forward.rs index be9df7e2b0..bae7cb8c8e 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_logging(); let (config, key_expr, forward) = parse_args(); diff --git a/examples/examples/z_get.rs b/examples/examples/z_get.rs index 2069e20b31..e8f0876120 100644 --- a/examples/examples/z_get.rs +++ b/examples/examples/z_get.rs @@ -20,7 +20,7 @@ use zenoh_examples::CommonArgs; #[tokio::main] async fn main() { // initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_logging(); 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..99911a577b 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_logging(); let (config, key_expr, timeout) = parse_args(); diff --git a/examples/examples/z_get_shm.rs b/examples/examples/z_get_shm.rs index 71a3e3aa65..01b50b4b64 100644 --- a/examples/examples/z_get_shm.rs +++ b/examples/examples/z_get_shm.rs @@ -30,7 +30,7 @@ const N: usize = 10; #[tokio::main] async fn main() { // initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_logging(); let (mut config, selector, mut payload, target, timeout) = parse_args(); diff --git a/examples/examples/z_info.rs b/examples/examples/z_info.rs index d2e4bfdbc0..9fa6c8b44b 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_logging(); let config = parse_args(); diff --git a/examples/examples/z_liveliness.rs b/examples/examples/z_liveliness.rs index 7bc8e857fe..83b22442b8 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_logging(); let (config, key_expr) = parse_args(); diff --git a/examples/examples/z_ping.rs b/examples/examples/z_ping.rs index 96454da614..1641602a38 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_logging(); 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 5e809c9341..66bd611a2e 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_logging(); let (mut config, warmup, size, n) = parse_args(); diff --git a/examples/examples/z_pong.rs b/examples/examples/z_pong.rs index 6a1b8580c7..d2a411beff 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_logging(); let (mut config, express) = parse_args(); diff --git a/examples/examples/z_pub.rs b/examples/examples/z_pub.rs index 2130832fb4..7fa5387160 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_logging(); 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 fd3c7ce1b6..28d86da0b1 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_logging(); let (mut config, path, payload) = parse_args(); diff --git a/examples/examples/z_pub_shm_thr.rs b/examples/examples/z_pub_shm_thr.rs index 3093a0962d..8bfac44d9c 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_logging(); let (mut config, sm_size, size) = parse_args(); // A probing procedure for shared memory is performed upon session opening. To enable `z_pub_shm_thr` to operate diff --git a/examples/examples/z_pub_thr.rs b/examples/examples/z_pub_thr.rs index 359e375203..bdbf2ce336 100644 --- a/examples/examples/z_pub_thr.rs +++ b/examples/examples/z_pub_thr.rs @@ -20,7 +20,7 @@ use zenoh_examples::CommonArgs; fn main() { // initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_logging(); 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..4b499fdc7f 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_logging(); let (config, key_expr, size, interval) = parse_args(); diff --git a/examples/examples/z_put.rs b/examples/examples/z_put.rs index bc4dd88eed..80be135e7f 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_logging(); 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..c792d43429 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_logging(); let (config, key_expr, payload) = parse_args(); diff --git a/examples/examples/z_queryable.rs b/examples/examples/z_queryable.rs index 7857c8caff..8c80a978b0 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_logging(); let (mut config, key_expr, payload, complete) = parse_args(); diff --git a/examples/examples/z_queryable_shm.rs b/examples/examples/z_queryable_shm.rs index 75da0379e2..12c801e528 100644 --- a/examples/examples/z_queryable_shm.rs +++ b/examples/examples/z_queryable_shm.rs @@ -28,7 +28,7 @@ const N: usize = 10; #[tokio::main] async fn main() { // initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_logging(); let (mut config, key_expr, payload, complete) = parse_args(); diff --git a/examples/examples/z_scout.rs b/examples/examples/z_scout.rs index 1d485991fd..c3addd5cf2 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_logging(); 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..ab4531b7d8 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_logging(); let (config, key_expr, complete) = parse_args(); diff --git a/examples/examples/z_sub.rs b/examples/examples/z_sub.rs index 8ecc4b9818..711ebeb896 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_logging(); let (mut config, key_expr) = parse_args(); diff --git a/examples/examples/z_sub_liveliness.rs b/examples/examples/z_sub_liveliness.rs index bb91c9f491..1868e87b1a 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_logging(); let (config, key_expr) = parse_args(); diff --git a/examples/examples/z_sub_shm.rs b/examples/examples/z_sub_shm.rs index e32c6140ac..3eeb98e9c5 100644 --- a/examples/examples/z_sub_shm.rs +++ b/examples/examples/z_sub_shm.rs @@ -18,7 +18,7 @@ use zenoh_examples::CommonArgs; #[tokio::main] async fn main() { // Initiate logging - zenoh::try_init_log_from_env(); + zenoh::init_logging(); let (mut config, key_expr) = parse_args(); diff --git a/examples/examples/z_sub_thr.rs b/examples/examples/z_sub_thr.rs index 0e9f53f36b..1324b8f954 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_logging(); let (mut config, m, n) = parse_args(); diff --git a/zenoh/src/lib.rs b/zenoh/src/lib.rs index e07b8b6806..7325737a03 100644 --- a/zenoh/src/lib.rs +++ b/zenoh/src/lib.rs @@ -112,14 +112,16 @@ pub const FEATURES: &str = zenoh_util::concat_enabled_features!( ); #[doc(inline)] -pub use { - crate::{ - config::Config, - core::{Error, Result}, - scouting::scout, - session::{open, Session}, - }, - zenoh_util::{init_log_from_env_or, try_init_log_from_env}, +pub use zenoh_util::{ + init_log_from_env_or as init_logging_with, try_init_log_from_env as init_logging, +}; + +#[doc(inline)] +pub use crate::{ + config::Config, + core::{Error, Result}, + scouting::scout, + session::{open, Session}, }; pub mod prelude; @@ -403,6 +405,8 @@ pub mod internal { }; } + pub use zenoh_util::init_log_with_callback; + pub use crate::api::value::Value; } diff --git a/zenoh/tests/acl.rs b/zenoh/tests/acl.rs index 6086a048ee..4c89391047 100644 --- a/zenoh/tests/acl.rs +++ b/zenoh/tests/acl.rs @@ -34,7 +34,7 @@ mod test { #[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn test_acl() { - zenoh::try_init_log_from_env(); + zenoh::init_logging(); test_pub_sub_deny().await; test_pub_sub_allow().await; test_pub_sub_deny_then_allow().await; diff --git a/zenoh/tests/interceptors.rs b/zenoh/tests/interceptors.rs index 3ee2c51828..93179d2c46 100644 --- a/zenoh/tests/interceptors.rs +++ b/zenoh/tests/interceptors.rs @@ -182,7 +182,7 @@ fn downsampling_by_keyexpr_impl(flow: InterceptorFlow) { #[test] fn downsampling_by_keyexpr() { - zenoh::try_init_log_from_env(); + zenoh::init_logging(); downsampling_by_keyexpr_impl(InterceptorFlow::Ingress); downsampling_by_keyexpr_impl(InterceptorFlow::Egress); } @@ -235,7 +235,7 @@ fn downsampling_by_interface_impl(flow: InterceptorFlow) { #[cfg(unix)] #[test] fn downsampling_by_interface() { - zenoh::try_init_log_from_env(); + zenoh::init_logging(); downsampling_by_interface_impl(InterceptorFlow::Ingress); downsampling_by_interface_impl(InterceptorFlow::Egress); } @@ -243,7 +243,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_logging(); let mut config = Config::default(); config diff --git a/zenoh/tests/matching.rs b/zenoh/tests/matching.rs index 13a05a268e..30599ae5c1 100644 --- a/zenoh/tests/matching.rs +++ b/zenoh/tests/matching.rs @@ -40,7 +40,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_logging(); let (session1, session2) = create_session_pair("tcp/127.0.0.1:18001").await; let publisher1 = ztimeout!(session1 @@ -92,7 +92,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_logging(); let session1 = ztimeout!(zenoh::open(config::peer())).unwrap(); let session2 = ztimeout!(zenoh::open(config::peer())).unwrap(); @@ -147,7 +147,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_logging(); 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 a6336e863a..e927e921b2 100644 --- a/zenoh/tests/open_time.rs +++ b/zenoh/tests/open_time.rs @@ -136,7 +136,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_logging(); let endpoint: EndPoint = format!("tcp/127.0.0.1:{}", 14000).parse().unwrap(); time_universal_open(&endpoint, WhatAmI::Client).await; } @@ -145,7 +145,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_logging(); let endpoint: EndPoint = format!("tcp/127.0.0.1:{}", 14100).parse().unwrap(); time_lowlatency_open(&endpoint, WhatAmI::Client).await; } @@ -154,7 +154,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_logging(); let endpoint: EndPoint = format!("udp/127.0.0.1:{}", 14010).parse().unwrap(); time_universal_open(&endpoint, WhatAmI::Client).await; } @@ -163,7 +163,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_logging(); let endpoint: EndPoint = format!("udp/127.0.0.1:{}", 14110).parse().unwrap(); time_lowlatency_open(&endpoint, WhatAmI::Client).await; } @@ -172,7 +172,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_logging(); // let endpoint: EndPoint = format!("ws/127.0.0.1:{}", 14020).parse().unwrap(); // time_universal_open(&endpoint, WhatAmI::Client).await; // } @@ -181,7 +181,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_logging(); // let endpoint: EndPoint = format!("ws/127.0.0.1:{}", 14120).parse().unwrap(); // time_lowlatency_open(&endpoint, WhatAmI::Client).await; // } @@ -190,7 +190,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_logging(); let endpoint: EndPoint = "unixpipe/time_unixpipe_only_open".parse().unwrap(); time_universal_open(&endpoint, WhatAmI::Client).await; } @@ -199,7 +199,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_logging(); let endpoint: EndPoint = "unixpipe/time_unixpipe_only_with_lowlatency_open" .parse() .unwrap(); @@ -210,7 +210,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_logging(); let f1 = "zenoh-test-unix-socket-9-open.sock"; let _ = std::fs::remove_file(f1); let endpoint: EndPoint = format!("unixsock-stream/{f1}").parse().unwrap(); @@ -225,7 +225,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_logging(); // 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 @@ -421,7 +421,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_logging(); 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 b632434c08..515b3fbd34 100644 --- a/zenoh/tests/routing.rs +++ b/zenoh/tests/routing.rs @@ -363,7 +363,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_logging(); let locator = String::from("tcp/127.0.0.1:17446"); let ke = String::from("testKeyExprGossip"); @@ -431,7 +431,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_logging(); let locator = String::from("tcp/127.0.0.1:17449"); let ke = String::from("testKeyExprStaticFailoverBrokering"); let msg_size = 8; @@ -492,7 +492,7 @@ async fn static_failover_brokering() -> Result<()> { // Total cases = 2 x 4 x 6 = 48 #[tokio::test(flavor = "multi_thread", worker_threads = 9)] async fn three_node_combination() -> Result<()> { - zenoh::try_init_log_from_env(); + zenoh::init_logging(); let modes = [WhatAmI::Peer, WhatAmI::Client]; let delay_in_secs = [ (0, 1, 2), @@ -623,7 +623,7 @@ async fn three_node_combination() -> Result<()> { // Total cases = 2 x 8 = 16 #[tokio::test(flavor = "multi_thread", worker_threads = 8)] async fn two_node_combination() -> Result<()> { - zenoh::try_init_log_from_env(); + zenoh::init_logging(); #[derive(Clone, Copy)] struct IsFirstListen(bool); diff --git a/zenoh/tests/session.rs b/zenoh/tests/session.rs index 25adaf42e0..9c8a1cfa47 100644 --- a/zenoh/tests/session.rs +++ b/zenoh/tests/session.rs @@ -246,7 +246,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_logging(); 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; @@ -255,7 +255,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_logging(); 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 43205e8e47..074c538b6c 100644 --- a/zenoh/tests/shm.rs +++ b/zenoh/tests/shm.rs @@ -181,7 +181,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_logging(); let (peer01, peer02) = open_session_unicast(&["tcp/127.0.0.1:19447"]).await; test_session_pubsub(&peer01, &peer02, Reliability::Reliable).await; @@ -193,7 +193,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_logging(); 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 6ce01ff2bf..ceb7fb8c98 100644 --- a/zenoh/tests/unicity.rs +++ b/zenoh/tests/unicity.rs @@ -257,7 +257,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_logging(); let (s01, s02, s03) = open_p2p_sessions().await; test_unicity_pubsub(&s01, &s02, &s03).await; @@ -267,7 +267,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_logging(); let r = open_router_session().await; let (s01, s02, s03) = open_client_sessions().await;