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

util/log: show span ID for all spans, not just root. The attached comment before was WRONG; each span has a unique ID.

darkfi пре 8 месеци
родитељ
комит
09a7c7e869
1 измењених фајлова са 4 додато и 11 уклоњено
  1. 4 11
      src/util/logger.rs

+ 4 - 11
src/util/logger.rs

@@ -219,18 +219,11 @@ where
             // Displays the full span tree
             for (span_idx, span) in spans.into_iter().enumerate() {
                 let span_name = bold.paint(span.metadata().name());
+                // Crop span_id to 6 chars
+                let span_id = span.id().into_u64().to_string();
+                let span_id = &span_id[..span_id.len().min(6)];
+                write!(writer, "{span_name}[{span_id}]")?;
 
-                // Only need to show the span ID once for the root span
-                // since its the same for all child spans too.
-                if !seen {
-                    // Crop span_id to 6 chars
-                    let span_id = span.id().into_u64().to_string();
-                    let span_id = &span_id[..span_id.len().min(6)];
-
-                    write!(writer, "{span_name}({span_id})")?;
-                } else {
-                    write!(writer, "{span_name}")?;
-                }
                 seen = true;
 
                 // Only show the fields of the last span