davidbarsky / tracing-tree

Apache License 2.0
123 stars 31 forks source link

Make timestamp padding always be the same depth. #57

Closed oli-obk closed 1 year ago

oli-obk commented 1 year ago

fixes #13

I opted to always make the ms be in the same position by moving to second/minute numbers after 999ms and after 59s respectively. Once we get into minute territory, having very long numbers doesn't really matter for tracing imo. We'll easily be able to add hours or days if that becomes desirable.

The basic example now looks like

image

instead of

image

oli-obk commented 1 year ago

@hawkw opinions on this style? Your original proposal was slightly different, but I don't know if that was important to you or just one option to get the indentation right.

oli-obk commented 1 year ago

I can also use - instead of spaces when lines are being used for indentation. This way we'd get something like

1:main┐basic::hierarchical-example version=0.1
1:main├┐basic::hierarchical-example version=0.1
1:main│└┐basic::server host="localhost", port=8080
1:main│ ├───0ms  INFO basic starting
1:main│ ├───3s   INFO basic listening
1:main│ ├┐basic::server host="localhost", port=8080
1:main│ │└┐basic::conn peer_addr="82.9.9.9", port=42381
1:main│ │ ├───0ms DEBUG basic connected
1:main│ │ ├─300ms DEBUG basic message received, length=2
1:main│ │┌┘basic::conn peer_addr="82.9.9.9", port=42381
1:main│ ├┘basic::server host="localhost", port=8080
1:main│ ├┐basic::server host="localhost", port=8080
1:main│ │└┐basic::conn peer_addr="8.8.8.8", port=18230
1:main│ │ ├─300ms DEBUG basic connected
davidbarsky commented 1 year ago

For what it's worth, I think this looks reasonable. Do you think it should build atop to https://github.com/davidbarsky/tracing-tree/pull/56/?

oli-obk commented 1 year ago

Yea, it's easier for me to Rebase than for someone to rebase over this PR