Skip to content

Allow setting with_span_events on the tracing Layer #353

@RemiBardon

Description

@RemiBardon

I'd like to set .with_span_events(FmtSpan::NEW | FmtSpan::CLOSE) on the tracing Layer when running Cucumber, but there is no API for it. I have tried plenty of workarounds, but I always get duplicated, unordered or missing logs. Could you please provide an API for customizing your tracing Layer?

Activity

added a commit that references this issue on Jan 7, 2025
self-assigned this
on Jan 20, 2025
added
enhancementImprovement of existing features or bugfix
questionFurther information is requested
k::apiRelated to API (application interface)
on Jan 20, 2025
tyranron

tyranron commented on Jan 20, 2025

@tyranron
Member

@RemiBardon could you elaborate more on this? It's hard for me to understand why .configure_and_init_tracing() doesn't solve your problem, given that you're free to do pretty much everything with the fmt_layer passed to the closure?

RemiBardon

RemiBardon commented on Jan 20, 2025

@RemiBardon
Author

@tyranron fmt_layer is not a Layer, it's a Layered, which means it doesn't have the with_span_events function. Your library doesn't expose a way to access this function on the non-Layered Layer (which is what I need).

tyranron

tyranron commented on Jan 20, 2025

@tyranron
Member

@RemiBardon actually, the struct Layered implements the Layer trait. However, you're referring to the fmt::Layer struct and its method, not the Layer trait. I see... and you want to access the initialized fmt::layer() directly to tweak it. Layered::downcast_ref() won't be much help here too, because the required methods have the self receiver, and we don't have Layered::downcast_mut() to mem::swap() it in any way too.

Ok. I will play with possible API extensions to support it and will ask your opinion on it. Thanks for making this clear!

RemiBardon

RemiBardon commented on Jan 20, 2025

@RemiBardon
Author

@tyranron Oh yes sorry I was on my phone I tried to remember my previous explorations. Thank you for looking into it!

linked a pull request that will close this issue on Jan 20, 2025
added this to the 0.22.0 milestone on Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementImprovement of existing features or bugfixk::apiRelated to API (application interface)questionFurther information is requested

Type

No type

Projects

No projects

Relationships

None yet

    Development

    Participants

    @tyranron@RemiBardon

    Issue actions

      Allow setting `with_span_events` on the `tracing` `Layer` · Issue #353 · cucumber-rs/cucumber