diff --git a/examples/logging.rs b/examples/logging.rs index d6a4e3575d..bc2153d9ad 100644 --- a/examples/logging.rs +++ b/examples/logging.rs @@ -11,10 +11,12 @@ //! //! To use the dioxus logger in your app, simply call any of the tracing functions (info!(), warn!(), error!()) -use dioxus::logger::tracing::{debug, error, info, warn}; +#[allow(unused_imports)] +use dioxus::logger::tracing::{debug, error, info, warn, Level}; use dioxus::prelude::*; fn main() { + dioxus::logger::init(Level::INFO).expect("Failed to initialize logger"); dioxus::launch(app); } @@ -31,7 +33,10 @@ fn app() -> Element { "Error!" } button { - onclick: move |_| debug!("Here's a debug"), + onclick: move |_| { + debug!("Here's a debug"); + warn!("The log level is set to info so there should not be a debug message") + }, "Debug!" } button {