-
Notifications
You must be signed in to change notification settings - Fork 184
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
feat(tests): Improve test_utils to warn about mutli-runtime tests #1280
Conversation
This enables the test-local logging output also for multi-threaded tests. The usage is not as nice as the entire test needs to be wrapped in an async block, but it works.
let var = std::env::var_os("RUST_LOG"); | ||
let trace_log_layer = match var { | ||
Some(_) => None, | ||
None => Some( | ||
tracing_subscriber::fmt::layer() | ||
.with_span_events(FmtSpan::CLOSE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also shows a log line when a span is closed. I find this really nice as you very clearly see things finish.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every thing that makes spans more readable is welcome. By the way - is there a way to use RUST_LOG to get rid of the span info in each log line? I find it a bit overwhelming sometimes...
2023-07-19T12:47:00.734742Z DEBUG conn{name=magic-78c000c451139ad8}:derp.actor:recv_detail:client-connect{key=PublicKey(78c000c451139ad8a8a77e9b5fe752b18320a9c551c0959ee71a85f24c82de15)}: rustls::client::hs: Using ciphersuite TLS13_AES_256_GCM_SHA384
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way - is there a way to use RUST_LOG to get rid of the span info in each log line? I find it a bit overwhelming sometimes...
2023-07-19T12:47:00.734742Z DEBUG conn{name=magic-78c000c451139ad8}:derp.actor:recv_detail:client-connect{key=PublicKey(78c000c451139ad8a8a77e9b5fe752b18320a9c551c0959ee71a85f24c82de15)}: rustls::client::hs: Using ciphersuite TLS13_AES_256_GCM_SHA384
Yeah, it is a lot of stuff. Though I find it very useful information. I sometimes wonder about making some kind of interactive tui to explore tracing output more interactively... but someone else will have to write it probably.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
though often you only have to go scan all the way to the right for the few things you care about. that's a little mitigating i guess.
@dignifiedquire @rklaehn could I get either an LGTM or more changes requested? |
Description
This detects if setup_logging() is going to blow up in your face and warns
against it.
Also adds closed spans to the log output.
Notes & open questions
It works this time? I'm as surprised as anything.It did not work, reverted this to be just the other improvements of the logging stuff under test.
Change checklist
Documentation updates if relevant.Tests if relevant.