Skip to content

Commit

Permalink
Fixed issue with extra indentation making it hard to read traces.
Browse files Browse the repository at this point in the history
  • Loading branch information
obsgolem committed Oct 17, 2023
1 parent 8723df3 commit 68a053e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
28 changes: 14 additions & 14 deletions examples/no-indent.stdout
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
1:main no_indent::hierarchical-example version=0.1
1:main no_indent::server host="localhost", port=8080
1:main Xms INFO no_indent starting
1:main Xms INFO no_indent listening
1:main Xms INFO no_indent starting
1:main Xms INFO no_indent listening
1:main no_indent::conn peer_addr="82.9.9.9", port=42381
1:main Xms DEBUG no_indent connected
1:main Xms DEBUG no_indent message received, length=2
1:main Xms DEBUG no_indent connected
1:main Xms DEBUG no_indent message received, length=2
1:main no_indent::conn peer_addr="8.8.8.8", port=18230
1:main Xms DEBUG no_indent connected
1:main Xms DEBUG no_indent connected
1:main no_indent::foomp 42 <- format string, normal_var=43
1:main Xms ERROR no_indent hello
1:main Xms ERROR no_indent hello
1:main no_indent::conn peer_addr="82.9.9.9", port=42381
1:main Xms WARN no_indent weak encryption requested, algo="xor"
1:main Xms DEBUG no_indent response sent, length=8
1:main Xms DEBUG no_indent disconnected
1:main Xms WARN no_indent weak encryption requested, algo="xor"
1:main Xms DEBUG no_indent response sent, length=8
1:main Xms DEBUG no_indent disconnected
1:main no_indent::conn peer_addr="8.8.8.8", port=18230
1:main Xms DEBUG no_indent message received, length=5
1:main Xms DEBUG no_indent response sent, length=8
1:main Xms DEBUG no_indent disconnected
1:main Xs WARN no_indent internal error
1:main Xs INFO no_indent exit
1:main Xms DEBUG no_indent message received, length=5
1:main Xms DEBUG no_indent response sent, length=8
1:main Xms DEBUG no_indent disconnected
1:main Xs WARN no_indent internal error
1:main Xs INFO no_indent exit
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,10 +538,11 @@ where
}
}

let deindent = if self.config.indent_lines { 0 } else { 1 };
// printing the indentation
let indent = ctx
.event_scope(event)
.map(|scope| scope.count())
.map(|scope| scope.count() - deindent)
.unwrap_or(0);

// check if this event occurred in the context of a span.
Expand Down

0 comments on commit 68a053e

Please sign in to comment.