dioxus_logger

Function initialize_default

Source
pub fn initialize_default()
Expand description

Attempt to initialize the subscriber if it doesn’t already exist, with default settings.

See crate::init for more info.

If you’re doing setup before your dioxus::launch function that requires lots of logging, then it might be worth calling this earlier than launch.

dioxus::launch calls this for you automatically and won’t replace any facade you’ve already set.

§Example

use dioxus::prelude::*;
use tracing::info;

fn main() {
    dioxus::logger::initialize_default();

    info!("Doing some work before launching...");

    dioxus::launch(App);
}

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