Преглед изворни кода

util/log: only show fields for span on enter and close

darkfi пре 8 месеци
родитељ
комит
5c3b100b8e
2 измењених фајлова са 2 додато и 2 уклоњено
  1. 1 1
      bin/app/src/prop/guard.rs
  2. 1 1
      src/util/logger.rs

+ 1 - 1
bin/app/src/prop/guard.rs

@@ -87,7 +87,7 @@ impl Drop for PropertyAtomicGuard {
 
 impl std::fmt::Debug for PropertyAtomicGuard {
     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
-        f.debug_struct("PropertyAtomicGuard").field("batch_id", &self.batch_id).finish()
+        write!(f, "@{:?}", self.batch_id)
     }
 }
 

+ 1 - 1
src/util/logger.rs

@@ -226,7 +226,7 @@ where
                 seen = true;
 
                 // Only show the fields of the last span
-                if span_idx == last_span_idx {
+                if meta.is_span() && span_idx == last_span_idx {
                     let ext = span.extensions();
                     if let Some(fields) = &ext.get::<FormattedFields<N>>() {
                         if !fields.is_empty() {