-
Notifications
You must be signed in to change notification settings - Fork 71
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
Allow configure fmt::Layer
better (#353)
#356
base: main
Are you sure you want to change the base?
Conversation
@RemiBardon could you try out this new API and report back? cucumber = { branch = "353-fmt-layer-tweaking", git = "https://github.com/cucumber-rs/cucumber", features = ["tracing"] } And the API change in the following manner:
Thanks! |
@tyranron I will have a look later today or tomorrow at the latest. Thank you for the proposal! |
Ok so I had a try and it turns out one of the issues I had encountered is that
between each step. I'm pretty sure you use these events internally and used I had managed to filter the ERROR events last time I tried, I'll try again in a sec. You should probably hide it though since no one will ever want to see |
I suppose I need to add .with_filter(
tracing_subscriber::filter::Targets::new()
.with_target("cucumber::tracing", tracing_subscriber::filter::LevelFilter::OFF),
) to When I return let targets = vec![
/* whatever */
("cucumber::tracing", LevelFilter::OFF),
];
let default_level: LevelFilter = /* whatever */;
tracing_subscriber::registry().with(
filter::Targets::new()
.with_default(default_level)
.with_targets(targets)
.and_then(fmt_layer),
) in the closure, logs become unordered. Well, not completely unordered, but cucumber events don't appear at the right moment. I believe this is because of your internal handling of events that I turned off. |
Here are some logs to make my explanation clearer (as a screenshot because colors are very useful in this case): Without filtering:With filtering:In both cases, some cucumber events are missing ( I will try to create a MRE so you can add check yourself and investigate. |
Here are the full logs, with color: Tip You can re-run it in your terminal to scroll back to lines which passed very quickly or download a text version. |
Here is a MRE:
|
@tyranron I forgot to ping you. I don't know if you have notifications on for non-mentionned comments so I just make sure. Sorry for the double notification if it's the case. |
@RemiBardon yes, I'm notified on any changes in this repo. I just haven't had time yet to look into this again. Will try to do it till the next week. |
Resolves #353
Synopsis
See #353 (comment) and #353 (comment) for details:
So, the current
Cucumber::configure_and_init_tracing()
API is quite limiting regarding the initializedfmt::Layer
in the way that allows only specifying its.fmt_fields()
and.event_format()
directly.Solution
Instead of accepting only
.fmt_fields()
and.event_format()
inCucumber::configure_and_init_tracing()
, let's accept the wholefmt::Layer
struct and reconfigure it before passing to the closure.This doesn't make the API surface harder, since the following code
becomes
but allows tweaking the
fmt::layer()
much more.Checklist