-
Notifications
You must be signed in to change notification settings - Fork 80
Allow configure fmt::Layer
better (#353)
#356
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
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. |
Hey @tyranron! Have you had the chance to look into this again or have planned to? |
Hello @tyranron, hope you are doing well! Do you think you’ll have some time to look into this at some point? It doesn’t impact me as much as when I had reported the issue since I managed to debug the big concurrency thing I had to debug but I’d still love if cucumber-rs could get this improvement 🙂 Best regards, |
@RemiBardon hi! Thank you for a kind reminder! I do remember about this PR, and somewhat touched it previous months multiple times. However, it proved to be a little bit deeper rabbit hole than I had time to spend my hands on it. For the next 2 months, I'm unsure to have enough time for investing into I'm glad to hear that this doesn't block or impact you, and sorry for not being able to resolve this quicker. |
No problem I understand. This already took too much of your time, I should be the one investigating it if I want it to move forward 😌 However I'm not familiar with the internals of We can close this now if you want to take that virtual weight off your shoulders, and we'll see if I make a comeback one day 😄 |
If I may chime it, I have followed this issue since shortly after its creation because I also ran into the tracing configuration limits. Similarly to Remi, it's not blocking me, but I hope that one day @tyranron will achieve the goal of this PR. |
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