-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
[Merged by Bors] - Fix suppression of all console logs when trace_tracy
is enabled
#6955
[Merged by Bors] - Fix suppression of all console logs when trace_tracy
is enabled
#6955
Conversation
Bevy was failing to print events from `info!()` and friends to the console if the `trace_tracy` feature was enabled. The problem was this per-layer filter that was added in bevyengine#4320 to suppress a noisy per-frame event (which Tracy requires in order to properly close out a frame): - The problem event's target was `"bevy_render::renderer"`, not `"tracy"`. - So, the filter wasn't specifically targeting the noisy event. - Without a default, `tracing_subscriber::filter::Targets` will remove _everything_ that doesn't match an explicit target rule. - So, the filter _was_ silencing the noisy event, along with everything else. This commit changes that filter to do what was probably intended in bevyengine#4320: suppress any events more verbose than `ERROR` from `bevy_render::renderer`, but allow anything else that already made it through the top-level filter_layer.
Is it possible to use something like https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.FilterFn.html to filter the frame_mark event more specifically? |
It looks like it is possible: let fmt_layer =
fmt_layer.with_filter(tracing_subscriber::filter::FilterFn::new(|meta| {
!meta.fields().field("tracy.frame_mark").is_some()
})); |
Yeah!! I was messing with a FilterFn in the process of figuring out why the existing target filter wasn't doing what I expected. But since I'm not familiar enough with the performance characteristics of Tracing subscribers, I opted to keep the filter type the same. If there's no noteworthy difference, I'd also be in favor of more surgical targeting. |
Definitely worth looking at perf, but I'm not really sure how to approach that. My instinct is that it wouldn't be a big deal and the default subscriber is doing most of its work just writing to stdout. |
Yeah that matches my intuition. I'm in favor of surgical targeting unless we have hard data that it's too expensive. |
👍🏼 OK, I'll do that. |
This converts the previous Target-based filter to a closure filter that only removes the one problematic event, allowing any other events that might get added to bevy_render::renderer over time.
0dee74f
to
de6a4da
Compare
ok, cargo fmt appeased |
perf seems more or less the same with many foxes of note is that the console logs get a lot more noisy
but that's probably better than not getting the messages. |
bors r+ |
) # Objective Fixes #6862 (oh hey good catch @alice-i-cecile) Bevy was failing to print events from `info!()` and friends to the console if the `trace_tracy` feature was enabled. It shouldn't be doing that. ## Solution The problem was this per-layer filter that was added in #4320 to suppress a noisy per-frame event (which Tracy requires in order to properly close out a frame): - The problem event's target was `"bevy_render::renderer"`, not `"tracy"`. - So, the filter wasn't specifically targeting the noisy event. - Without a default, `tracing_subscriber::filter::Targets` will remove _everything_ that doesn't match an explicit target rule. - So, the filter _was_ silencing the noisy event, along with everything else. This PR changes that filter to do what was probably intended in #4320: suppress ~any events more verbose than `ERROR` from `bevy_render::renderer`~ the one problematically noisy event, but allow anything else that already made it through the top-level filter_layer. Also, adds a comment to clarify the intent of that filter, since it's otherwise a bit opaque and required some research. --- ## Changelog Fixed a bug that hid console log messages when the `trace_tracy` feature was enabled.
trace_tracy
is enabledtrace_tracy
is enabled
…vyengine#6955) # Objective Fixes bevyengine#6862 (oh hey good catch @alice-i-cecile) Bevy was failing to print events from `info!()` and friends to the console if the `trace_tracy` feature was enabled. It shouldn't be doing that. ## Solution The problem was this per-layer filter that was added in bevyengine#4320 to suppress a noisy per-frame event (which Tracy requires in order to properly close out a frame): - The problem event's target was `"bevy_render::renderer"`, not `"tracy"`. - So, the filter wasn't specifically targeting the noisy event. - Without a default, `tracing_subscriber::filter::Targets` will remove _everything_ that doesn't match an explicit target rule. - So, the filter _was_ silencing the noisy event, along with everything else. This PR changes that filter to do what was probably intended in bevyengine#4320: suppress ~any events more verbose than `ERROR` from `bevy_render::renderer`~ the one problematically noisy event, but allow anything else that already made it through the top-level filter_layer. Also, adds a comment to clarify the intent of that filter, since it's otherwise a bit opaque and required some research. --- ## Changelog Fixed a bug that hid console log messages when the `trace_tracy` feature was enabled.
…vyengine#6955) # Objective Fixes bevyengine#6862 (oh hey good catch @alice-i-cecile) Bevy was failing to print events from `info!()` and friends to the console if the `trace_tracy` feature was enabled. It shouldn't be doing that. ## Solution The problem was this per-layer filter that was added in bevyengine#4320 to suppress a noisy per-frame event (which Tracy requires in order to properly close out a frame): - The problem event's target was `"bevy_render::renderer"`, not `"tracy"`. - So, the filter wasn't specifically targeting the noisy event. - Without a default, `tracing_subscriber::filter::Targets` will remove _everything_ that doesn't match an explicit target rule. - So, the filter _was_ silencing the noisy event, along with everything else. This PR changes that filter to do what was probably intended in bevyengine#4320: suppress ~any events more verbose than `ERROR` from `bevy_render::renderer`~ the one problematically noisy event, but allow anything else that already made it through the top-level filter_layer. Also, adds a comment to clarify the intent of that filter, since it's otherwise a bit opaque and required some research. --- ## Changelog Fixed a bug that hid console log messages when the `trace_tracy` feature was enabled.
Objective
Fixes #6862 (oh hey good catch @alice-i-cecile)
Bevy was failing to print events from
info!()
and friends to the console if thetrace_tracy
feature was enabled. It shouldn't be doing that.Solution
The problem was this per-layer filter that was added in #4320 to suppress a noisy per-frame event (which Tracy requires in order to properly close out a frame):
"bevy_render::renderer"
, not"tracy"
. - So, the filter wasn't specifically targeting the noisy event.tracing_subscriber::filter::Targets
will remove everything that doesn't match an explicit target rule. - So, the filter was silencing the noisy event, along with everything else.This PR changes that filter to do what was probably intended in #4320: suppress
any events more verbose thanthe one problematically noisy event, but allow anything else that already made it through the top-level filter_layer.ERROR
frombevy_render::renderer
Also, adds a comment to clarify the intent of that filter, since it's otherwise a bit opaque and required some research.
Changelog
Fixed a bug that hid console log messages when the
trace_tracy
feature was enabled.