-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Log Plugin #836
Log Plugin #836
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Though in your opening statement you said you wouldn’t point to my branch because it can’t be published to crates.io, yet my branch is still in the Cargo.toml.
EDIT: no, you said that in the review of my PR. Well, still, I’m not sure it was intentional to point to my branch.
I just checked-out this branch and it looks very cool on native. Kudos. Although the constant spamming of messages to browser console will make development for web impossible. (and eventually grind browser tab to a halt) |
Yeah we might need to either wait for them to publish the next version of wasm_tracing or publish our own version while we wait. |
If it would be blocking Bevy release, we might just temporarily disable configuring logging on wasm and rely on people still using |
@cart it looks like tracing-wasm has a max_level thing in its configuration. But also there should be a way to define a filter layer even if it didn't. There are other filter layers than just the |
Also, it looks like |
crates/bevy_log/src/lib.rs
Outdated
#[cfg(target_arch = "wasm32")] | ||
fn setup_wasm() { | ||
console_error_panic_hook::set_once(); | ||
tracing_wasm::set_as_global_default(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this and do something more like setup_default
except use tracing-wasm instead of tracing-chrome. It would be nice if one could pass in or set some variable to configure the filter directives passed to EnvFilter::try_new()
as a string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah the master branch has a max_level
configuration item, but the crates.io version doesn't (which is why the issue I filed in their repo is asking for them to cut a new release).
The env filter does seem like a nice workaround though. Good call!
I was playing with it today in browser and after little tweaking it works great! Like @superdump mentioned above filterning on wasm can be enabled the same way as for native:
With bits of
|
Oh, I like that idea! Changing URI fragments don't cause page reloads if I recall correctly... I wonder if you can edit it on the fly and have the filters change...? :) @mrk-its |
@superdump yes: https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onhashchange Unfortunately a lot of js apps use fragment some way and it may interfere with them. The other interesting option is |
Just added a simple android Feel free to follow up with WASM niceties like local storage filtering if the fancy strikes you 😄 |
This builds on the work in #789 by adding a new
bevy_log
plugin. It removes alllog
crate access in favor oftracing
, and all log initialization code tobevy_log
. This is nice because the wasm examples are cleaned up significantly.bevy_log re-exports tracing types, which are now available in bevy::prelude (so you can just do
info!("hello")
bevy_utils re-exports tracing (for use in core crates like bevy_app, which can't consume the bevy_log plugin)
I also moved the "chrome tracing" from the example to an optional
trace_chrome
feature, which enables that subscriber in bevy_log.Followups:
tracing
subscriber.