Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace custom logging by tracing #2814

Merged
merged 6 commits into from Aug 7, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/yew/Cargo.toml
Expand Up @@ -33,6 +33,7 @@ bincode = { version = "1.3.3", optional = true }
serde = { version = "1", features = ["derive"] }
tokio = { version = "1.19", features = ["sync"] }
tokio-stream = { version = "0.1.9", features = ["sync"] }
tracing = "0.1.36"

[dependencies.web-sys]
version = "0.3"
Expand Down
14 changes: 14 additions & 0 deletions packages/yew/src/app_handle.rs
Expand Up @@ -24,6 +24,11 @@ where
/// similarly to the `program` function in Elm. You should provide an initial model, `update`
/// function which will update the state of the model and a `view` function which
/// will render the model to a virtual DOM tree.
#[tracing::instrument(
level = tracing::Level::DEBUG,
name = "mount",
skip(props),
)]
pub(crate) fn mount_with_props(host: Element, props: Rc<COMP::Properties>) -> Self {
clear_element(&host);
let app = Self {
Expand All @@ -42,6 +47,10 @@ where
}

/// Schedule the app for destruction
#[tracing::instrument(
level = tracing::Level::DEBUG,
skip_all,
)]
pub fn destroy(self) {
self.scope.destroy(false)
}
Expand Down Expand Up @@ -74,6 +83,11 @@ mod feat_hydration {
where
COMP: BaseComponent,
{
#[tracing::instrument(
level = tracing::Level::DEBUG,
name = "hydrate",
skip(props),
)]
pub(crate) fn hydrate_with_props(host: Element, props: Rc<COMP::Properties>) -> Self {
let app = Self {
scope: Scope::new(None),
Expand Down