Open
Description
The .without_time()
call mentioned in the readme is not strictly necessary.
The following setup allows timing information to be displayed by using the time
crate using it's wasm-bindgen
feature which enables wasm support.
In Cargo.toml
, define the following dependencies:
time = { version = "0.3.23", features = ["wasm-bindgen"] }
tracing = "0.1.37"
tracing-subscriber = { version = "0.3.17", features = ["time", "local-time"] }
tracing-subscriber-wasm = "0.1.0"
And in your rust setup code, make use of the .with_timer
function:
use tracing_subscriber::fmt::{fmt, time::LocalTime};
use tracing_subscriber_wasm::MakeConsoleWriter;
fmt()
.with_writer(
// To avoid trace events in the browser from showing their
// JS backtrace, which is very annoying, in my opinion
MakeConsoleWriter::default().map_trace_level_to(tracing::Level::DEBUG),
)
.with_timer(LocalTime::rfc_3339())
.pretty()
.init();
You can use different implementations. See
- https://docs.rs/tracing-subscriber/0.3.17/tracing_subscriber/fmt/struct.SubscriberBuilder.html#method.with_timer and
- https://docs.rs/tracing-subscriber/0.3.17/tracing_subscriber/fmt/time/index.html
for more information.
Example output:
2023-07-29T15:04:26.476999936+02:00 INFO simple::app: initialize <Test>
at examples\simple\src\app.rs:25
in leptos_dom::components::dyn_child::<DynChild />
in leptos_dom::Fn() -> impl IntoView
Metadata
Metadata
Assignees
Labels
No labels