Function dioxus_logger::init

source ·
pub fn init(level: Level) -> Result<(), SetGlobalDefaultError>
Expand description

Initialize dioxus-logger with a specified max filter. Generally it is best to initialize the logger before launching your Dioxus app. Works on Web, Desktop, Fullstack, and Liveview.

§Example

use dioxus::prelude::*;
use tracing::{Level, info};
 
fn main() {
    dioxus_logger::init(Level::INFO).expect("logger failed to init");
    launch(App);
}
 
#[component]
fn App() -> Element {
    info!("App rendered");
    rsx! {
        p { "hi" }
    }
}