mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
preliminary tracing for tachys
This commit is contained in:
parent
2788d93e96
commit
5bc97654dc
3 changed files with 13 additions and 0 deletions
|
@ -83,6 +83,7 @@ miniserde = ["leptos_reactive/miniserde"]
|
|||
rkyv = ["leptos_reactive/rkyv", "server_fn/rkyv"]
|
||||
tracing = [
|
||||
"reactive_graph/tracing",
|
||||
"tachys/tracing"
|
||||
] #, "leptos_macro/tracing", "leptos_dom/tracing"]
|
||||
nonce = ["base64", "leptos_dom/nonce", "rand"]
|
||||
spin = ["leptos_reactive/spin", "leptos-spin-macro"]
|
||||
|
|
|
@ -155,6 +155,7 @@ send_wrapper = "0.6"
|
|||
linear-map = "1.2.0"
|
||||
sledgehammer_bindgen = { version = "0.4", features = ["web"], optional = true }
|
||||
sledgehammer_utils = { version = "0.2", optional = true }
|
||||
tracing = { version = "0.1", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
tokio-test = "0.4"
|
||||
|
@ -172,3 +173,4 @@ nightly = ["reactive_graph/nightly"]
|
|||
testing = ["dep:slotmap"]
|
||||
reactive_graph = ["dep:reactive_graph"]
|
||||
sledgehammer = ["dep:sledgehammer_bindgen", "dep:sledgehammer_utils"]
|
||||
tracing = ["dep:tracing"]
|
||||
|
|
|
@ -166,7 +166,17 @@ where
|
|||
}
|
||||
|
||||
let mut cb = self.cb.take();
|
||||
|
||||
#[cfg(feature = "tracing")]
|
||||
let span = tracing::Span::current();
|
||||
|
||||
let cb = Box::new(move |ev: R::Event| {
|
||||
#[cfg(all(debug_assertions, feature = "reactive_graph"))]
|
||||
let _rx_guard =
|
||||
reactive_graph::diagnostics::SpecialNonReactiveZone::enter();
|
||||
#[cfg(feature = "tracing")]
|
||||
let _tracing_guard = span.enter();
|
||||
|
||||
let ev = E::EventType::from(ev);
|
||||
cb.invoke(ev);
|
||||
}) as Box<dyn FnMut(R::Event)>;
|
||||
|
|
Loading…
Reference in a new issue