diff --git a/Cargo.lock b/Cargo.lock index 1b6a2e9a..acdf68c9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -500,7 +500,7 @@ dependencies = [ [[package]] name = "rmp-ipc" -version = "0.7.1" +version = "0.7.2" dependencies = [ "criterion", "lazy_static", diff --git a/Cargo.toml b/Cargo.toml index 99cba423..780c7c3d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rmp-ipc" -version = "0.7.1" +version = "0.7.2" authors = ["trivernis "] edition = "2018" readme = "README.md" diff --git a/src/events/event.rs b/src/events/event.rs index 768a55c8..7eec77c0 100644 --- a/src/events/event.rs +++ b/src/events/event.rs @@ -24,7 +24,7 @@ struct EventHeader { impl Event { /// Creates a new event with a namespace - #[tracing::instrument(level = "trace")] + #[tracing::instrument(level = "trace", skip(data))] pub fn with_namespace( namespace: String, name: String, @@ -41,7 +41,7 @@ impl Event { } /// Creates a new event - #[tracing::instrument(level = "trace")] + #[tracing::instrument(level = "trace", skip(data))] pub fn new(name: String, data: Vec, ref_id: Option) -> Self { let header = EventHeader { id: generate_event_id(), @@ -107,7 +107,7 @@ impl Event { } /// Encodes the event into bytes - #[tracing::instrument(level = "trace")] + #[tracing::instrument(level = "trace", skip(self))] pub fn into_bytes(mut self) -> Result> { let mut header_bytes = rmp_serde::to_vec(&self.header)?; let header_length = header_bytes.len() as u16; diff --git a/src/events/event_handler.rs b/src/events/event_handler.rs index 7df84bad..8cd9a897 100644 --- a/src/events/event_handler.rs +++ b/src/events/event_handler.rs @@ -54,7 +54,7 @@ impl EventHandler { } /// Handles a received event - #[tracing::instrument(level = "debug", skip(self, ctx))] + #[tracing::instrument(level = "debug", skip(self, ctx, event))] pub async fn handle_event(&self, ctx: &Context, event: Event) -> Result<()> { if let Some(cb) = self.callbacks.get(event.name()) { cb.as_ref()(ctx, event).await?; diff --git a/src/ipc/mod.rs b/src/ipc/mod.rs index e6e196af..b0d370b9 100644 --- a/src/ipc/mod.rs +++ b/src/ipc/mod.rs @@ -20,7 +20,12 @@ async fn handle_connection( ctx: Context, ) { while let Ok(event) = Event::from_async_read(&mut read_half).await { - tracing::trace!("event = {:?}", event); + tracing::trace!( + "event.name = {:?}, event.namespace = {:?}, event.reference_id = {:?}", + event.name(), + event.namespace(), + event.reference_id() + ); // check if the event is a reply if let Some(ref_id) = event.reference_id() { tracing::trace!("Event has reference id. Passing to reply listener"); diff --git a/src/ipc/stream_emitter.rs b/src/ipc/stream_emitter.rs index 37cbef91..13b549fd 100644 --- a/src/ipc/stream_emitter.rs +++ b/src/ipc/stream_emitter.rs @@ -23,7 +23,7 @@ impl StreamEmitter { } } - #[tracing::instrument(level = "trace", skip(self))] + #[tracing::instrument(level = "trace", skip(self, data))] pub async fn _emit( &self, namespace: Option<&str>, @@ -116,6 +116,7 @@ impl EmitMetadata { } /// Waits for a reply to the given message. + #[tracing::instrument(skip(self, ctx), fields(self.message_id))] pub async fn await_reply(&self, ctx: &Context) -> Result { let reply = ctx.await_reply(self.message_id).await?; Ok(reply)