Skip to content
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

Add support for updating the tracing subscriber in LogPlugin #10822

Merged
merged 5 commits into from
Jan 15, 2024

Conversation

cBournhonesque
Copy link
Contributor

Objective

This PR is heavily inspired by #7682
It aims to solve the same problem: allowing the user to extend the tracing subscriber with extra layers.

(in my case, I'd like to use use metrics_tracing_context::{MetricsLayer, TracingContextLayer};)

Solution

I'm proposing a different api where the user has the opportunity to take the existing subscriber and apply any transformations on it.


Changelog

  • Added a update_subscriber option on the LogPlugin that lets the user modify the subscriber (for example to extend it with more tracing Layers

Migration Guide

This section is optional. If there are no breaking changes, you can delete this section.

  • Added a new field update_subscriber in the LogPlugin

Copy link
Contributor

github-actions bot commented Dec 1, 2023

The generated examples/README.md is out of sync with the example metadata in Cargo.toml or the example readme template. Please run cargo run -p build-templated-pages -- update examples to update it, and commit the file change.

@Nilirad Nilirad added C-Usability A targeted quality-of-life change that makes Bevy easier to use A-Diagnostics Logging, crash handling, error reporting and performance analysis labels Dec 1, 2023
Copy link
Member

@james7132 james7132 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM sans the member naming.


/// Optionally apply extra transformations to the tracing subscriber.
/// For example add [`Layers`](tracing_subscriber::layer::Layer)
pub update_subscriber: Option<fn(BoxedSubscriber) -> BoxedSubscriber>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the biggest fan of this naming, but this work. Not a strict blocker.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe extend_tracing_subscriber_fn?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe configure/configure_callback

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current name makes sense to me.configure_subscriber maybe?

Copy link
Contributor

@MiniaczQ MiniaczQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks alright


/// Optionally apply extra transformations to the tracing subscriber.
/// For example add [`Layers`](tracing_subscriber::layer::Layer)
pub update_subscriber: Option<fn(BoxedSubscriber) -> BoxedSubscriber>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe configure/configure_callback

@matiqo15 matiqo15 added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Jan 14, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jan 15, 2024
Merged via the queue into bevyengine:main with commit 8c6d9b8 Jan 15, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Diagnostics Logging, crash handling, error reporting and performance analysis C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants