From 633b83412e8f48d4d97b27885fe4461c6f367f91 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Mon, 30 Aug 2021 12:01:47 +0200 Subject: [PATCH] Use tracing's macros for debug/display; enable dataspace debug --- syndicate/src/actor.rs | 8 ++++---- syndicate/src/dataspace.rs | 6 +++--- syndicate/src/relay.rs | 8 ++++---- syndicate/src/tracer.rs | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/syndicate/src/actor.rs b/syndicate/src/actor.rs index 002b770..6f7dd98 100644 --- a/syndicate/src/actor.rs +++ b/syndicate/src/actor.rs @@ -511,12 +511,12 @@ impl FacetRef { state); for action in std::mem::take(&mut t.state.exit_hooks) { if let Err(err) = action(&mut t, &exit_status) { - tracing::error!(err = debug(err), "error in exit hook"); + tracing::error!(?err, "error in exit hook"); } } if let Err(err) = t._terminate_facet(t.state.root, false) { // This can only occur as the result of an internal error in this file's code. - tracing::error!(err = debug(err), "unexpected error from disorderly terminate_facet"); + tracing::error!(?err, "unexpected error from disorderly terminate_facet"); panic!("Unexpected error result from disorderly terminate_facet"); } *g = ActorState::Terminated { @@ -1342,12 +1342,12 @@ impl Drop for Facet { { let mut b = EventBuffer::new(Account::new(crate::name!("drop"))); for (_handle, r) in to_clear.into_iter() { - tracing::trace!(h = debug(&_handle), "retract on termination"); + tracing::trace!(h = ?_handle, "retract on termination"); b.execute_cleanup_action(r); } } - tracing::trace!(facet_id = debug(self.facet_id), "Facet::drop"); + tracing::trace!(facet_id = ?self.facet_id, "Facet::drop"); } } diff --git a/syndicate/src/dataspace.rs b/syndicate/src/dataspace.rs index 8e49016..26df3a0 100644 --- a/syndicate/src/dataspace.rs +++ b/syndicate/src/dataspace.rs @@ -92,7 +92,7 @@ impl Dataspace { impl Entity<_Any> for Dataspace { fn assert(&mut self, t: &mut Activation, a: _Any, h: Handle) -> ActorResult { - // tracing::trace!(assertion = debug(&a), handle = debug(&h), "assert"); + tracing::trace!(assertion = ?a, handle = ?h, "assert"); // let old_assertions = self.index.assertion_count(); self.index.insert(t, &a); @@ -110,7 +110,7 @@ impl Entity<_Any> for Dataspace { } fn retract(&mut self, t: &mut Activation, h: Handle) -> ActorResult { - // tracing::trace!(handle = debug(&h), "retract"); + tracing::trace!(handle = ?h, "retract"); if let Some((a, maybe_o)) = self.handle_map.remove(&h) { if let Some(o) = maybe_o { @@ -127,7 +127,7 @@ impl Entity<_Any> for Dataspace { } fn message(&mut self, t: &mut Activation, m: _Any) -> ActorResult { - // tracing::trace!(body = debug(&m), "message"); + tracing::trace!(body = ?m, "message"); // self.index.send(t, &m, &mut self.churn.messages_delivered); self.index.send(t, &m); diff --git a/syndicate/src/relay.rs b/syndicate/src/relay.rs index 44a2703..e31f7e7 100644 --- a/syndicate/src/relay.rs +++ b/syndicate/src/relay.rs @@ -252,11 +252,11 @@ impl TunnelRelay { } fn handle_inbound_packet(&mut self, t: &mut Activation, p: P::Packet) -> ActorResult { - // tracing::trace!(packet = debug(&p), "-->"); + // tracing::trace!(packet = ?p, "-->"); match p { P::Packet::Error(b) => { - tracing::info!(message = debug(b.message.clone()), - detail = debug(b.detail.clone()), + tracing::info!(message = ?b.message.clone(), + detail = ?b.detail.clone(), "received Error from peer"); Err(*b) }, @@ -372,7 +372,7 @@ impl TunnelRelay { fn encode_packet(&mut self, p: P::Packet) -> Result, Error> { let item = AnyValue::from(&p); - // tracing::trace!(packet = debug(&item), "<--"); + // tracing::trace!(packet = ?item, "<--"); if self.output_text { let mut s = TextWriter::encode::<_, AnyValue, _>(&mut self.membranes, &item)?; s.push('\n'); diff --git a/syndicate/src/tracer.rs b/syndicate/src/tracer.rs index b932a69..e82a35d 100644 --- a/syndicate/src/tracer.rs +++ b/syndicate/src/tracer.rs @@ -21,22 +21,22 @@ pub fn tracer(t: &mut Activation, name: tracing::Span) -> Arc> impl Entity for Tracer { fn assert(&mut self, _t: &mut Activation, a: M, h: Handle) -> ActorResult { let _guard = self.0.enter(); - tracing::trace!(a = debug(&a), h = debug(&h), "assert"); + tracing::trace!(?a, ?h, "assert"); Ok(()) } fn retract(&mut self, _t: &mut Activation, h: Handle) -> ActorResult { let _guard = self.0.enter(); - tracing::trace!(h = debug(&h), "retract"); + tracing::trace!(?h, "retract"); Ok(()) } fn message(&mut self, _t: &mut Activation, m: M) -> ActorResult { let _guard = self.0.enter(); - tracing::trace!(m = debug(&m), "message"); + tracing::trace!(?m, "message"); Ok(()) } fn sync(&mut self, t: &mut Activation, peer: Arc>) -> ActorResult { let _guard = self.0.enter(); - tracing::trace!(peer = debug(&peer), "sync"); + tracing::trace!(?peer, "sync"); t.message(&peer, Synced); Ok(()) }