Преглед на файлове

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 {
 impl std::fmt::Debug for PropertyAtomicGuard {
     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
     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;
                 seen = true;
 
 
                 // Only show the fields of the last span
                 // 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();
                     let ext = span.extensions();
                     if let Some(fields) = &ext.get::<FormattedFields<N>>() {
                     if let Some(fields) = &ext.get::<FormattedFields<N>>() {
                         if !fields.is_empty() {
                         if !fields.is_empty() {