Skip to content

Commit

Permalink
Merge pull request #73 from obsgolem/main
Browse files Browse the repository at this point in the history
Fixed issue with extra indentation making it hard to read traces.
  • Loading branch information
oli-obk authored Apr 4, 2024
2 parents cdb2c5a + 68a053e commit 996552d
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 @@ -537,10 +537,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 996552d

Please sign in to comment.