Switch SSR examples from wasm-logger to tracing-web#4054
Switch SSR examples from wasm-logger to tracing-web#4054
Conversation
Co-authored-by: Madoshakalaka <44753941+Madoshakalaka@users.noreply.github.com>
WorldSEnder
left a comment
There was a problem hiding this comment.
There are other examples that use wasm_logger at the moment which could switch as well. Further, this does currently not configure a the same logging level as previously, which should be easy enough to fix with tracing_subscriber's API.
I specifically only did it to SSR examples, because tracing-web actually benefits there by collecting on the server side too. our docs does mention all options so mayybe there is not enough motivation in switching all exampes? Actually, now that I looked at the source,
will fix. |
|
@copilot fix. |
Co-authored-by: Madoshakalaka <44753941+Madoshakalaka@users.noreply.github.com>
Madoshakalaka
left a comment
There was a problem hiding this comment.
looks good. I'm not sure if we should add .with_timer(UtcTime::rfc_3339()) to the examples. Opinions? @WorldSEnder
I recommend against it in the tracing-web docs, besides missing (sys) support from |
TIL worked amazing life saver, thanks |
The two SSR examples (
simple_ssr,ssr_router) usedwasm-logger/logfor browser-side logging. These are migrated totracing-web+tracing-subscriber, consistent with the pattern established in yew-trunk-minimal-template.Changes
Cargo.toml(workspace): Addtracing-web = "0.1"andtracing-subscriber = { version = "0.3", features = ["fmt"] }as workspace dependencies.examples/simple_ssr/Cargo.toml/examples/ssr_router/Cargo.toml: Replacewasm-logger(andlog) withtracing-web+tracing-subscriberin[target.'cfg(target_arch = "wasm32")'.dependencies].*_hydrate.rsbinaries: Replacewasm_logger::init(...)with atracing-subscriberregistry backed byMakeWebConsoleWriter.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.