bevyengine / bevyengine/bevy

Ability to trace bevy systems when running `wasm32-unknown-unknown` builds in the browser

Open
#18,256 0 comments 3 reactions 0 assignees View on GitHub
A-Diagnostics C-Bug O-Web S-Needs-Investigation X-Uncontroversial
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## What problem does this solve or what need does it fill?

Hi folks! I'm trying to debug [an issue in nannou's support for the `webgl2` target](https://github.com/nannou-org/nannou/issues/998). Specifically, a wgpu buffer error `slice offset 0 is out of range for buffer of size 0`.

In order to debug this, I first want to find what system this is happening in.

In a native build, I'd just enable the system tracing with bevy's `trace` feature, however I've noticed the WASM logging appears to be limited to the `debug` level - even when explicitly enabling `Level::TRACE` in the `LogPlugin` initialisation.

I noticed that `wasm-server-runner` had the `release_max_level_debug` feature enabled for the tracing crate, but even after patching it and removing this feature, I still can't seem to see `trace!` output in wasm builds.

## What solution would you like?

To either:

- enable `trace!` logging for WASM builds or
- have the option to emit system tracing via `debug!` rather than `trace!` so that we can still debug systems in the browser.

Any advice or workarounds for this also appreciated!

Contributor guide

Open the contributing guide

Research direction

Start by reproducing a wasm32-unknown-unknown browser build with Bevy's trace feature and LogPlugin configured for Level::TRACE. Inspect how wasm-server-runner's release_max_level_debug setting affects tracing, and compare the available system tracing output. Done means system trace events are visible in the browser or a documented debug-level fallback is provided.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
game-dev, observability
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.