dioxus_logger

Function 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 dioxus::logger::tracing::{Level, info};

fn main() {
    dioxus::logger::init(Level::INFO).expect("logger failed to init");
    dioxus::launch(App);
}

#[component]
fn App() -> Element {
    info!("App rendered");
    rsx! {
        p { "hi" }
    }
}