Skip to content

Commit

Permalink
Document usage of the tracing crate (#2831)
Browse files Browse the repository at this point in the history
  • Loading branch information
WorldSEnder authored Aug 16, 2022
1 parent 5079885 commit 8172b9c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions website/docs/more/debugging.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ fn main() {
log::info!("Update: {:?}", msg);
```

## Debugging component lifecycles

Yew makes use of the [`tracing`](https://crates.io/crates/tracing) crate to emit debug information about lifecycle events of components. These can be used to trace why and when a component is created, updated, rerendered or destroyed.

To make use of this, you need to [register a `Subscriber`](https://docs.rs/tracing/latest/tracing/#in-executables) or enable the `"log"` feature for compatibility with the `log` crate, e.g. when using `wasm-logger`. A subscriber is supposed to be chosen only by the final executable crate, not by library crates. You can also turn on compile-time [flags to disable logging](https://docs.rs/tracing/latest/tracing/level_filters/index.html#compile-time-filters) statically, for a smaller wasm file size.

## Source Maps

There is currently no first-class support for source maps for Rust / Wasm web apps. This, of course, is subject to change. If this is no longer true or if progress is made, please suggest a change!
Expand Down

0 comments on commit 8172b9c

Please sign in to comment.