Skip to content

Switch SSR examples from wasm-logger to tracing-web#4054

Open
Copilot wants to merge 2 commits intomasterfrom
copilot/configure-ssr-examples-tracing-web
Open

Switch SSR examples from wasm-logger to tracing-web#4054
Copilot wants to merge 2 commits intomasterfrom
copilot/configure-ssr-examples-tracing-web

Conversation

Copy link

Copilot AI commented Mar 7, 2026

The two SSR examples (simple_ssr, ssr_router) used wasm-logger/log for browser-side logging. These are migrated to tracing-web + tracing-subscriber, consistent with the pattern established in yew-trunk-minimal-template.

Changes

  • Cargo.toml (workspace): Add tracing-web = "0.1" and tracing-subscriber = { version = "0.3", features = ["fmt"] } as workspace dependencies.
  • examples/simple_ssr/Cargo.toml / examples/ssr_router/Cargo.toml: Replace wasm-logger (and log) with tracing-web + tracing-subscriber in [target.'cfg(target_arch = "wasm32")'.dependencies].
  • *_hydrate.rs binaries: Replace wasm_logger::init(...) with a tracing-subscriber registry backed by MakeWebConsoleWriter.
#[cfg(target_arch = "wasm32")]
{
    let fmt_layer = tracing_subscriber::fmt::layer()
        .with_ansi(false) // Only partially supported across browsers
        .without_time()   // std::time is not available in browsers
        .with_writer(tracing_web::MakeWebConsoleWriter::new());
    use tracing_subscriber::prelude::*;
    tracing_subscriber::registry().with(fmt_layer).init();
}

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: Madoshakalaka <44753941+Madoshakalaka@users.noreply.github.com>
Copilot AI changed the title [WIP] Configure SSR examples to use tracing-web instead of wasm-logger Switch SSR examples from wasm-logger to tracing-web Mar 7, 2026
@Madoshakalaka Madoshakalaka marked this pull request as ready for review March 7, 2026 09:22
@Madoshakalaka Madoshakalaka added the A-examples Area: The examples label Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-examples Area: The examples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants