Skip to content

Fixed issue with extra indentation making it hard to read traces. #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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