From 4f15c5b6bcbdfc1aa73b99e86b8d87afd158ede1 Mon Sep 17 00:00:00 2001 From: Joseph Perez Date: Thu, 11 Jul 2024 15:18:02 +0200 Subject: [PATCH 1/4] chore: replace log by tracing --- Cargo.lock | 40 ++++--------------- Cargo.toml | 3 +- src/closures/hello_closure.rs | 2 +- src/closures/matching_status_closure.rs | 2 +- src/closures/query_closure.rs | 2 +- src/closures/reply_closure.rs | 2 +- src/closures/sample_closure.rs | 2 +- src/closures/zenohid_closure.rs | 2 +- src/commons.rs | 2 +- src/config.rs | 6 +-- src/get.rs | 2 +- src/keyexpr.rs | 16 ++++---- src/lib.rs | 2 +- src/liveliness.rs | 8 ++-- src/payload.rs | 14 +++---- src/publication_cache.rs | 4 +- src/publisher.rs | 12 +++--- src/put.rs | 4 +- src/queryable.rs | 10 ++--- src/querying_subscriber.rs | 6 +-- src/scouting.rs | 2 +- src/session.rs | 10 ++--- .../posix/posix_shm_provider.rs | 2 +- src/shm/provider/alloc_layout_impl.rs | 6 +-- src/shm/provider/shm_provider_impl.rs | 2 +- src/shm/provider/types.rs | 2 +- src/subscriber.rs | 4 +- 27 files changed, 71 insertions(+), 98 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 786499faf..50f3d83fb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -661,19 +661,6 @@ version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbfc4744c1b8f2a09adc0e55242f60b1af195d88596bd8700be74418c056c555" -[[package]] -name = "env_logger" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" -dependencies = [ - "humantime", - "is-terminal", - "log", - "regex", - "termcolor", -] - [[package]] name = "equivalent" version = "1.0.1" @@ -1233,17 +1220,6 @@ dependencies = [ "serde", ] -[[package]] -name = "is-terminal" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" -dependencies = [ - "hermit-abi 0.3.2", - "rustix 0.38.32", - "windows-sys 0.48.0", -] - [[package]] name = "iter-read" version = "0.3.1" @@ -2906,11 +2882,10 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "log", "pin-project-lite", "tracing-attributes", @@ -2919,9 +2894,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", @@ -2930,9 +2905,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", "valuable", @@ -3627,7 +3602,6 @@ dependencies = [ "cbindgen", "chrono", "const_format", - "env_logger", "flume", "fs2", "fs_extra", @@ -3635,11 +3609,11 @@ dependencies = [ "json5", "lazy_static", "libc", - "log", "rand", "regex", "serde_yaml", "spin 0.9.8", + "tracing", "unwrap-infallible", "zenoh", "zenoh-ext", diff --git a/Cargo.toml b/Cargo.toml index f56d5ae3d..0a7ce5530 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,12 +43,11 @@ maintenance = { status = "actively-developed" } async-std = "=1.12.0" async-trait = "0.1.66" chrono = "0.4.37" -env_logger = "0.10.0" futures = "0.3.26" json5 = "0.4.1" lazy_static = "1.4.0" libc = "0.2.139" -log = "0.4.17" +tracing = "0.1" rand = "0.8.5" spin = "0.9.5" unwrap-infallible = "0.1.5" diff --git a/src/closures/hello_closure.rs b/src/closures/hello_closure.rs index 86cfb9eef..93483cb00 100644 --- a/src/closures/hello_closure.rs +++ b/src/closures/hello_closure.rs @@ -88,7 +88,7 @@ pub extern "C" fn z_closure_hello_call( match closure.call { Some(call) => call(hello, closure.context), None => { - log::error!("Attempted to call an uninitialized closure!"); + tracing::error!("Attempted to call an uninitialized closure!"); } } } diff --git a/src/closures/matching_status_closure.rs b/src/closures/matching_status_closure.rs index 52f68ef89..db3c96cfa 100644 --- a/src/closures/matching_status_closure.rs +++ b/src/closures/matching_status_closure.rs @@ -97,7 +97,7 @@ pub extern "C" fn zcu_closure_matching_status_call( match closure.call { Some(call) => call(mathing_status, closure.context), None => { - log::error!("Attempted to call an uninitialized closure!"); + tracing::error!("Attempted to call an uninitialized closure!"); } } } diff --git a/src/closures/query_closure.rs b/src/closures/query_closure.rs index 865683c51..7003acab1 100644 --- a/src/closures/query_closure.rs +++ b/src/closures/query_closure.rs @@ -93,7 +93,7 @@ pub extern "C" fn z_closure_query_call( let closure = closure.as_owned_c_type_ref(); match closure.call { Some(call) => call(query, closure.context), - None => log::error!("Attempted to call an uninitialized closure!"), + None => tracing::error!("Attempted to call an uninitialized closure!"), } } /// Drops the closure, resetting it to its gravestone state. diff --git a/src/closures/reply_closure.rs b/src/closures/reply_closure.rs index f6f3b5452..8a4f00d5a 100644 --- a/src/closures/reply_closure.rs +++ b/src/closures/reply_closure.rs @@ -94,7 +94,7 @@ pub extern "C" fn z_closure_reply_call( match closure.call { Some(call) => call(reply, closure.context), None => { - log::error!("Attempted to call an uninitialized closure!"); + tracing::error!("Attempted to call an uninitialized closure!"); } } } diff --git a/src/closures/sample_closure.rs b/src/closures/sample_closure.rs index 0badb3a5c..b35041a4b 100644 --- a/src/closures/sample_closure.rs +++ b/src/closures/sample_closure.rs @@ -94,7 +94,7 @@ pub extern "C" fn z_closure_sample_call( let closure = closure.as_owned_c_type_ref(); match closure.call { Some(call) => call(sample, closure.context), - None => log::error!("Attempted to call an uninitialized closure!"), + None => tracing::error!("Attempted to call an uninitialized closure!"), } } diff --git a/src/closures/zenohid_closure.rs b/src/closures/zenohid_closure.rs index 878374fec..7be0186b0 100644 --- a/src/closures/zenohid_closure.rs +++ b/src/closures/zenohid_closure.rs @@ -89,7 +89,7 @@ pub extern "C" fn z_closure_zid_call(closure: &z_loaned_closure_zid_t, z_id: &z_ match closure.call { Some(call) => call(z_id, closure.context), None => { - log::error!("Attempted to call an uninitialized closure!"); + tracing::error!("Attempted to call an uninitialized closure!"); } } } diff --git a/src/commons.rs b/src/commons.rs index 0be41184c..bde742d69 100644 --- a/src/commons.rs +++ b/src/commons.rs @@ -235,7 +235,7 @@ pub unsafe extern "C" fn z_encoding_from_substr( errors::Z_OK } Err(e) => { - log::error!("Can not create encoding from non UTF-8 string: {}", e); + tracing::error!("Can not create encoding from non UTF-8 string: {}", e); encoding.write(Encoding::default()); errors::Z_EINVAL } diff --git a/src/config.rs b/src/config.rs index dc6fb72df..51ea38e06 100644 --- a/src/config.rs +++ b/src/config.rs @@ -279,13 +279,13 @@ pub unsafe extern "C" fn zc_config_from_file( Ok(path) => match zenoh::config::Config::from_file(path) { Ok(c) => Some(c), Err(e) => { - log::error!("Couldn't read config from {}: {}", path, e); + tracing::error!("Couldn't read config from {}: {}", path, e); res = errors::Z_EPARSE; None } }, Err(e) => { - log::error!("Invalid path '{}': {}", path_str.to_string_lossy(), e); + tracing::error!("Invalid path '{}': {}", path_str.to_string_lossy(), e); res = errors::Z_EIO; None } @@ -324,7 +324,7 @@ pub unsafe extern "C" fn z_config_client( .map(|&s| CStr::from_ptr(s).to_string_lossy().parse()) .try_fold(Vec::::new(), |mut acc, it| match it { Err(e) => { - log::error!("Error parsing peer address: {}", e); + tracing::error!("Error parsing peer address: {}", e); res = errors::Z_EPARSE; Err(()) } diff --git a/src/get.rs b/src/get.rs index 13af08c4c..97be4717b 100644 --- a/src/get.rs +++ b/src/get.rs @@ -289,7 +289,7 @@ pub unsafe extern "C" fn z_get( { Ok(()) => errors::Z_OK, Err(e) => { - log::error!("{}", e); + tracing::error!("{}", e); errors::Z_EGENERIC } } diff --git a/src/keyexpr.rs b/src/keyexpr.rs index 4c0249a57..6c73d15ba 100644 --- a/src/keyexpr.rs +++ b/src/keyexpr.rs @@ -74,12 +74,12 @@ unsafe fn keyexpr_create( Ok(name) => match keyexpr_create_inner(name, should_auto_canonize, should_copy) { Ok(v) => Ok(v), Err(e) => { - log::error!("Couldn't construct a keyexpr: {}", e); + tracing::error!("Couldn't construct a keyexpr: {}", e); Err(errors::Z_EINVAL) } }, Err(e) => { - log::error!("{}", e); + tracing::error!("{}", e); Err(errors::Z_EPARSE) } } @@ -473,7 +473,7 @@ pub extern "C" fn z_declare_keyexpr( errors::Z_OK } Err(e) => { - log::debug!("{}", e); + tracing::debug!("{}", e); this.write(None); errors::Z_EGENERIC } @@ -489,14 +489,14 @@ pub extern "C" fn z_undeclare_keyexpr( session: &z_loaned_session_t, ) -> errors::z_error_t { let Some(kexpr) = this.as_rust_type_mut().take() else { - log::debug!("Attempted to undeclare dropped keyexpr"); + tracing::debug!("Attempted to undeclare dropped keyexpr"); return errors::Z_EINVAL; }; let session = session.as_rust_type_ref(); match session.undeclare(kexpr).wait() { Ok(()) => errors::Z_OK, Err(e) => { - log::debug!("{}", e); + tracing::debug!("{}", e); errors::Z_EGENERIC } } @@ -554,7 +554,7 @@ pub unsafe extern "C" fn z_keyexpr_concat( let right = match std::str::from_utf8(right) { Ok(r) => r, Err(e) => { - log::error!( + tracing::error!( "Couldn't concatenate {:02x?} to {} because it is not valid UTF8: {}", right, left, @@ -570,7 +570,7 @@ pub unsafe extern "C" fn z_keyexpr_concat( errors::Z_OK } Err(e) => { - log::error!("{}", e); + tracing::error!("{}", e); this.write(None); errors::Z_EGENERIC } @@ -594,7 +594,7 @@ pub extern "C" fn z_keyexpr_join( errors::Z_OK } Err(e) => { - log::error!("{}", e); + tracing::error!("{}", e); this.write(None); errors::Z_EGENERIC } diff --git a/src/lib.rs b/src/lib.rs index 9825a0e56..729d653e1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -73,7 +73,7 @@ pub mod shm; /// this will be performed automatically by `z_open` and `z_scout`. #[no_mangle] pub extern "C" fn zc_init_logger() { - let _ = env_logger::try_init(); + zenoh::try_init_log_from_env(); } // Test should be runned with `cargo test --no-default-features` diff --git a/src/liveliness.rs b/src/liveliness.rs index cb75e532d..e7129a8ab 100644 --- a/src/liveliness.rs +++ b/src/liveliness.rs @@ -100,7 +100,7 @@ pub extern "C" fn zc_liveliness_declare_token( errors::Z_OK } Err(e) => { - log::error!("Failed to undeclare token: {e}"); + tracing::error!("Failed to undeclare token: {e}"); this.write(None); errors::Z_EGENERIC } @@ -115,7 +115,7 @@ pub extern "C" fn zc_liveliness_undeclare_token( let this = this.as_rust_type_mut(); if let Some(token) = this.take() { if let Err(e) = token.undeclare().wait() { - log::error!("Failed to undeclare token: {e}"); + tracing::error!("Failed to undeclare token: {e}"); return errors::Z_EGENERIC; } } @@ -171,7 +171,7 @@ pub extern "C" fn zc_liveliness_declare_subscriber( errors::Z_OK } Err(e) => { - log::error!("Failed to subscribe to liveliness: {e}"); + tracing::error!("Failed to subscribe to liveliness: {e}"); this.write(None); errors::Z_EGENERIC } @@ -219,7 +219,7 @@ pub extern "C" fn zc_liveliness_get( match builder.wait() { Ok(()) => errors::Z_OK, Err(e) => { - log::error!("Failed to subscribe to liveliness: {e}"); + tracing::error!("Failed to subscribe to liveliness: {e}"); errors::Z_EGENERIC } } diff --git a/src/payload.rs b/src/payload.rs index a7abbacd0..3c0733b9b 100644 --- a/src/payload.rs +++ b/src/payload.rs @@ -114,7 +114,7 @@ pub unsafe extern "C" fn z_bytes_deserialize_into_string( errors::Z_OK } Err(e) => { - log::error!("Failed to deserialize the payload: {}", e); + tracing::error!("Failed to deserialize the payload: {}", e); dst.as_rust_type_mut_uninit().write(CStringOwned::default()); errors::Z_EIO } @@ -138,7 +138,7 @@ pub unsafe extern "C" fn z_bytes_deserialize_into_slice( errors::Z_OK } Err(e) => { - log::error!("Failed to read the payload: {}", e); + tracing::error!("Failed to read the payload: {}", e); dst.as_rust_type_mut_uninit().write(CSliceOwned::default()); errors::Z_EIO } @@ -165,7 +165,7 @@ pub unsafe extern "C" fn z_bytes_deserialize_into_owned_shm( errors::Z_OK } Err(e) => { - log::error!("Failed to deserialize the payload: {:?}", e); + tracing::error!("Failed to deserialize the payload: {:?}", e); dst.as_rust_type_mut_uninit().write(None); errors::Z_EIO } @@ -192,7 +192,7 @@ pub unsafe extern "C" fn z_bytes_deserialize_into_loaned_shm( errors::Z_OK } Err(e) => { - log::error!("Failed to deserialize the payload: {:?}", e); + tracing::error!("Failed to deserialize the payload: {:?}", e); errors::Z_EIO } } @@ -218,7 +218,7 @@ pub unsafe extern "C" fn z_bytes_deserialize_into_mut_loaned_shm( errors::Z_OK } Err(e) => { - log::error!("Failed to deserialize the payload: {:?}", e); + tracing::error!("Failed to deserialize the payload: {:?}", e); errors::Z_EIO } } @@ -273,7 +273,7 @@ where errors::Z_OK } Err(e) => { - log::error!("Failed to deserialize the payload: {:?}", e); + tracing::error!("Failed to deserialize the payload: {:?}", e); errors::Z_EPARSE } } @@ -514,7 +514,7 @@ pub extern "C" fn z_bytes_deserialize_into_pair( Z_OK } Err(e) => { - log::error!("Failed to deserialize the payload: {:?}", e); + tracing::error!("Failed to deserialize the payload: {:?}", e); Z_EPARSE } } diff --git a/src/publication_cache.rs b/src/publication_cache.rs index 323524d6e..c84307d2b 100644 --- a/src/publication_cache.rs +++ b/src/publication_cache.rs @@ -101,7 +101,7 @@ pub extern "C" fn ze_declare_publication_cache( errors::Z_OK } Err(e) => { - log::error!("{}", e); + tracing::error!("{}", e); this.write(None); errors::Z_EGENERIC } @@ -131,7 +131,7 @@ pub extern "C" fn ze_undeclare_publication_cache( ) -> errors::z_error_t { if let Some(p) = this.as_rust_type_mut().take() { if let Err(e) = p.close().wait() { - log::error!("{}", e); + tracing::error!("{}", e); return errors::Z_EGENERIC; } } diff --git a/src/publisher.rs b/src/publisher.rs index e78277fef..bd0b40089 100644 --- a/src/publisher.rs +++ b/src/publisher.rs @@ -102,7 +102,7 @@ pub extern "C" fn z_declare_publisher( } match p.wait() { Err(e) => { - log::error!("{}", e); + tracing::error!("{}", e); this.write(None); errors::Z_EGENERIC } @@ -218,7 +218,7 @@ pub unsafe extern "C" fn z_publisher_put( } if let Err(e) = put.wait() { - log::error!("{}", e); + tracing::error!("{}", e); errors::Z_EGENERIC } else { errors::Z_OK @@ -261,7 +261,7 @@ pub extern "C" fn z_publisher_delete( } } if let Err(e) = del.wait() { - log::error!("{}", e); + tracing::error!("{}", e); errors::Z_EGENERIC } else { errors::Z_OK @@ -327,7 +327,7 @@ pub extern "C" fn zcu_publisher_matching_listener_callback( errors::Z_OK } Err(e) => { - log::error!("{}", e); + tracing::error!("{}", e); errors::Z_EGENERIC } } @@ -343,7 +343,7 @@ pub extern "C" fn zcu_publisher_matching_listener_undeclare( ) -> errors::z_error_t { if let Some(p) = this.as_rust_type_mut().take() { if let Err(e) = p.undeclare().wait() { - log::error!("{}", e); + tracing::error!("{}", e); return errors::Z_EGENERIC; } } @@ -358,7 +358,7 @@ pub extern "C" fn zcu_publisher_matching_listener_undeclare( pub extern "C" fn z_undeclare_publisher(this: &mut z_owned_publisher_t) -> errors::z_error_t { if let Some(p) = this.as_rust_type_mut().take() { if let Err(e) = p.undeclare().wait() { - log::error!("{}", e); + tracing::error!("{}", e); return errors::Z_EGENERIC; } } diff --git a/src/put.rs b/src/put.rs index fbaba0275..d729a5735 100644 --- a/src/put.rs +++ b/src/put.rs @@ -108,7 +108,7 @@ pub extern "C" fn z_put( } if let Err(e) = put.wait() { - log::error!("{}", e); + tracing::error!("{}", e); errors::Z_EGENERIC } else { errors::Z_OK @@ -177,7 +177,7 @@ pub extern "C" fn z_delete( match del.wait() { Err(e) => { - log::error!("{}", e); + tracing::error!("{}", e); errors::Z_EGENERIC } Ok(()) => errors::Z_OK, diff --git a/src/queryable.rs b/src/queryable.rs index 076e9c7d1..4b9f6e137 100644 --- a/src/queryable.rs +++ b/src/queryable.rs @@ -228,7 +228,7 @@ pub extern "C" fn z_declare_queryable( errors::Z_OK } Err(e) => { - log::error!("{}", e); + tracing::error!("{}", e); this.write(None); errors::Z_EGENERIC } @@ -243,7 +243,7 @@ pub extern "C" fn z_declare_queryable( pub extern "C" fn z_undeclare_queryable(this: &mut z_owned_queryable_t) -> errors::z_error_t { if let Some(qable) = this.as_rust_type_mut().take() { if let Err(e) = qable.undeclare().wait() { - log::error!("{}", e); + tracing::error!("{}", e); return errors::Z_EGENERIC; } } @@ -314,7 +314,7 @@ pub extern "C" fn z_query_reply( } if let Err(e) = reply.wait() { - log::error!("{}", e); + tracing::error!("{}", e); return errors::Z_EGENERIC; } errors::Z_OK @@ -353,7 +353,7 @@ pub unsafe extern "C" fn z_query_reply_err( ); if let Err(e) = reply.wait() { - log::error!("{}", e); + tracing::error!("{}", e); return errors::Z_EGENERIC; } errors::Z_OK @@ -403,7 +403,7 @@ pub unsafe extern "C" fn z_query_reply_del( } if let Err(e) = reply.wait() { - log::error!("{}", e); + tracing::error!("{}", e); return errors::Z_EGENERIC; } errors::Z_OK diff --git a/src/querying_subscriber.rs b/src/querying_subscriber.rs index d2b6cb92a..aba5d53ad 100644 --- a/src/querying_subscriber.rs +++ b/src/querying_subscriber.rs @@ -141,7 +141,7 @@ pub unsafe extern "C" fn ze_declare_querying_subscriber( errors::Z_OK } Err(e) => { - log::debug!("{}", e); + tracing::debug!("{}", e); this.write(None); errors::Z_EGENERIC } @@ -200,7 +200,7 @@ pub unsafe extern "C" fn ze_querying_subscriber_get( }) .wait() { - log::debug!("{}", e); + tracing::debug!("{}", e); return errors::Z_EGENERIC; } errors::Z_OK @@ -215,7 +215,7 @@ pub extern "C" fn ze_undeclare_querying_subscriber( ) -> errors::z_error_t { if let Some(s) = this.as_rust_type_mut().take() { if let Err(e) = s.0.close().wait() { - log::error!("{}", e); + tracing::error!("{}", e); return errors::Z_EGENERIC; } } diff --git a/src/scouting.rs b/src/scouting.rs index dbd14a74a..5169947b2 100644 --- a/src/scouting.rs +++ b/src/scouting.rs @@ -165,7 +165,7 @@ pub extern "C" fn z_scout( #[allow(clippy::unnecessary_cast)] // Required for multi-target let timeout = options.timeout_ms; let Some(config) = config.as_rust_type_mut().take() else { - log::error!("Config not provided"); + tracing::error!("Config not provided"); return errors::Z_EINVAL; }; let mut closure = z_owned_closure_hello_t::empty(); diff --git a/src/session.rs b/src/session.rs index 8735a157b..c8ee8d536 100644 --- a/src/session.rs +++ b/src/session.rs @@ -60,7 +60,7 @@ pub extern "C" fn z_open( zc_init_logger(); } let Some(config) = config.as_rust_type_mut().take() else { - log::error!("Config not provided"); + tracing::error!("Config not provided"); this.write(None); return errors::Z_EINVAL; }; @@ -70,7 +70,7 @@ pub extern "C" fn z_open( errors::Z_OK } Err(e) => { - log::error!("Error opening session: {}", e); + tracing::error!("Error opening session: {}", e); this.write(None); errors::Z_ENETWORK } @@ -93,7 +93,7 @@ pub extern "C" fn z_open_with_custom_shm_clients( zc_init_logger(); } let Some(config) = config.as_rust_type_mut().take() else { - log::error!("Config not provided"); + tracing::error!("Config not provided"); this.write(None); return errors::Z_EINVAL; }; @@ -106,7 +106,7 @@ pub extern "C" fn z_open_with_custom_shm_clients( errors::Z_OK } Err(e) => { - log::error!("Error opening session: {}", e); + tracing::error!("Error opening session: {}", e); this.write(None); errors::Z_ENETWORK } @@ -138,7 +138,7 @@ pub extern "C" fn z_close(this: &mut z_owned_session_t) -> errors::z_error_t { }; match s.close().wait() { Err(e) => { - log::error!("Error closing session: {}", e); + tracing::error!("Error closing session: {}", e); errors::Z_EGENERIC } Ok(_) => errors::Z_OK, diff --git a/src/shm/protocol_implementations/posix/posix_shm_provider.rs b/src/shm/protocol_implementations/posix/posix_shm_provider.rs index d8f8bbb5a..9773b622f 100644 --- a/src/shm/protocol_implementations/posix/posix_shm_provider.rs +++ b/src/shm/protocol_implementations/posix/posix_shm_provider.rs @@ -52,7 +52,7 @@ pub extern "C" fn z_posix_shm_provider_new( Z_OK } Err(e) => { - log::error!("{}", e); + tracing::error!("{}", e); Z_EINVAL } } diff --git a/src/shm/provider/alloc_layout_impl.rs b/src/shm/provider/alloc_layout_impl.rs index 6d3a0d753..49e46b70f 100644 --- a/src/shm/provider/alloc_layout_impl.rs +++ b/src/shm/provider/alloc_layout_impl.rs @@ -50,7 +50,7 @@ pub(crate) fn alloc_layout_new( { Ok(layout) => CSHMLayout::Posix(layout), Err(e) => { - log::error!("{:?}", e); + tracing::error!("{:?}", e); return Z_EINVAL; } } @@ -63,7 +63,7 @@ pub(crate) fn alloc_layout_new( { Ok(layout) => CSHMLayout::Dynamic(layout), Err(e) => { - log::error!("{:?}", e); + tracing::error!("{:?}", e); return Z_EINVAL; } } @@ -76,7 +76,7 @@ pub(crate) fn alloc_layout_new( { Ok(layout) => CSHMLayout::DynamicThreadsafe(layout), Err(e) => { - log::error!("{:?}", e); + tracing::error!("{:?}", e); return Z_EINVAL; } } diff --git a/src/shm/provider/shm_provider_impl.rs b/src/shm/provider/shm_provider_impl.rs index 09e3e8e96..54f126531 100644 --- a/src/shm/provider/shm_provider_impl.rs +++ b/src/shm/provider/shm_provider_impl.rs @@ -163,7 +163,7 @@ pub(crate) fn map( out_result.as_rust_type_mut_uninit().write(Some(buffer)); } Err(e) => { - log::error!("{e}"); + tracing::error!("{e}"); out_result.as_rust_type_mut_uninit().write(None); } } diff --git a/src/shm/provider/types.rs b/src/shm/provider/types.rs index a6bb94ddd..acb92622d 100644 --- a/src/shm/provider/types.rs +++ b/src/shm/provider/types.rs @@ -91,7 +91,7 @@ pub extern "C" fn z_memory_layout_new( Z_OK } Err(e) => { - log::error!("{e}"); + tracing::error!("{e}"); Z_EINVAL } } diff --git a/src/subscriber.rs b/src/subscriber.rs index 212779df2..f747d668a 100644 --- a/src/subscriber.rs +++ b/src/subscriber.rs @@ -133,7 +133,7 @@ pub extern "C" fn z_declare_subscriber( errors::Z_OK } Err(e) => { - log::error!("{}", e); + tracing::error!("{}", e); this.write(None); errors::Z_EGENERIC } @@ -158,7 +158,7 @@ pub extern "C" fn z_subscriber_keyexpr(subscriber: &z_loaned_subscriber_t) -> &z pub extern "C" fn z_undeclare_subscriber(this: &mut z_owned_subscriber_t) -> errors::z_error_t { if let Some(s) = this.as_rust_type_mut().take() { if let Err(e) = s.undeclare().wait() { - log::error!("{}", e); + tracing::error!("{}", e); return errors::Z_EGENERIC; } } From 4bc30c235ab82feeb903782f1d74fd8ec77daeeb Mon Sep 17 00:00:00 2001 From: Joseph Perez Date: Thu, 11 Jul 2024 15:41:18 +0200 Subject: [PATCH 2/4] fix: update Cargo.toml.in --- Cargo.toml.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Cargo.toml.in b/Cargo.toml.in index 496fcefef..0f3084b25 100644 --- a/Cargo.toml.in +++ b/Cargo.toml.in @@ -43,12 +43,11 @@ maintenance = { status = "actively-developed" } async-std = "=1.12.0" async-trait = "0.1.66" chrono = "0.4.37" -env_logger = "0.10.0" futures = "0.3.26" json5 = "0.4.1" lazy_static = "1.4.0" libc = "0.2.139" -log = "0.4.17" +tracing = "0.1" rand = "0.8.5" spin = "0.9.5" unwrap-infallible = "0.1.5" From 4e8631c4ac196984aa21e39b51d9908664cb8a39 Mon Sep 17 00:00:00 2001 From: Joseph Perez Date: Thu, 11 Jul 2024 15:42:07 +0200 Subject: [PATCH 3/4] fix: remove useless dependencies --- Cargo.toml.in | 2 -- 1 file changed, 2 deletions(-) diff --git a/Cargo.toml.in b/Cargo.toml.in index 0f3084b25..399317bc6 100644 --- a/Cargo.toml.in +++ b/Cargo.toml.in @@ -53,8 +53,6 @@ spin = "0.9.5" unwrap-infallible = "0.1.5" const_format = "0.2.32" zenoh = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "dev/1.0.0", default-features = false } -zenoh-protocol = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "dev/1.0.0" } -zenoh-util = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "dev/1.0.0" } zenoh-ext = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "dev/1.0.0" } flume = "*" From 04191fdd52b710dd4d458c4fbd4ab4b21eb29d07 Mon Sep 17 00:00:00 2001 From: Joseph Perez Date: Mon, 15 Jul 2024 15:22:35 +0200 Subject: [PATCH 4/4] fix: fix Cargo.toml.in --- Cargo.toml.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml.in b/Cargo.toml.in index 399317bc6..0d00f4aa8 100644 --- a/Cargo.toml.in +++ b/Cargo.toml.in @@ -32,7 +32,7 @@ build = "@CARGO_PROJECT_DIR@build.rs" [features] logger-autoinit = [] -shared-memory = ["zenoh/shared-memory", "zenoh-ext/shared-memory", "zenoh-protocol/shared-memory"] +shared-memory = ["zenoh/shared-memory", "zenoh-ext/shared-memory"] unstable = ["zenoh/unstable", "zenoh-ext/unstable"] default = ["zenoh/default"]