dioxus-logger

Crates.iodioxus-logger
lib.rsdioxus-logger
version0.7.0-rc.0
created_at2022-11-05 20:13:38.549888+00
updated_at2025-08-11 22:45:48.362675+00
descriptionA logging utility to provide a standard interface whether you're targeting web desktop, fullstack, and more.
homepagehttps://github.com/dioxuslabs/dioxus
repositoryhttps://github.com/dioxuslabs/dioxus
max_upload_size
id706092
size16,831
Jonathan Kelley (jkelleyrtp)

documentation

README

📡 Dioxus Logger 🛰️

A logging utility to provide a standard interface whether you're targeting web, desktop, fullstack, and more.

Crates.io version Download docs.rs docs

dioxus-logger is a basic cross-platform facade for logging in Dioxus that uses the tracing crate.

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" }
  }
}

Dioxus support

As of v0.6, dioxus_logger is part of dioxus itself. Dioxus will call init with a default Level, though you can still override the default with init.

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" }
  }
}

For non-wasm targets, runtime filtering is based on the RUST_LOG environment variable. e.g. for RUST_LOG=none,crateName=trace only logs trace and above for crateName will be captured. See here for syntax. For crates with - in the name, these need to be changed to _ in RUST_LOG.

Platform Support

Dioxus logger will eventually support every target that Dioxus does. Currently mobile and TUI are not supported.

Installation

dioxus_logger is part of Dioxus v0.6. If you're using Dioxus v0.6, then no installation is required!

If you're on Dioxus v0.5 and below, you can add dioxus-logger to your application by adding it to your dependencies.

[dependencies]
dioxus-logger = "0.5"

License

This project is licensed under the MIT license.

Every contribution intentionally submitted for inclusion in dioxus-logger by you, shall be licensed as MIT, without any additional terms or conditions.

Commit count: 6674

cargo fmt