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

Use log as our log backend instead of tracing #1590

Merged
merged 2 commits into from Mar 15, 2023
Merged

Use log as our log backend instead of tracing #1590

merged 2 commits into from Mar 15, 2023

Conversation

emilk
Copy link
Member

@emilk emilk commented Mar 14, 2023

It is so much simpler to write a backend for the log crate compared to tracing.

So this PR also adds a new log backend for the web which uses console.debug for debug-level logs, console.warn for warn level, etc etc. This means we can filter the logs in the browser.

Closes #1513

I tried this with all debug/info spam from wgpu, and there were no web crashes.

In the end, I still decided to put the wgpu log level at warn because of gfx-rs/wgpu#3206

Checklist

And make sure the web backend use the correct console.debug etc
@emilk emilk added 🕸️ web regarding running the viewer in a browser 🧑‍💻 dev experience developer experience (excluding CI) labels Mar 14, 2023
@emilk emilk marked this pull request as ready for review March 14, 2023 17:10
@Wumpf Wumpf self-requested a review March 15, 2023 14:16
Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

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

lgtm!

Comment on lines +20 to +23
if metadata.target().starts_with("wgpu") || metadata.target().starts_with("naga") {
// TODO(emilk): remove once https://github.com/gfx-rs/wgpu/issues/3206 is fixed
return metadata.level() <= log::LevelFilter::Warn;
}
Copy link
Member

Choose a reason for hiding this comment

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

Can we think of a good way to opt in to those logs? There are some situations where I want/need them. 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

I can think of a good way: comment out these lines and then recompile!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧑‍💻 dev experience developer experience (excluding CI) 🕸️ web regarding running the viewer in a browser
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wasm_bindgen-caused web crash when using more than 2GiB of RAM
2 participants