#logging #dioxus #logging-tracing #log #ui-framework

dioxus-logger

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

10 releases (5 breaking)

new 0.6.0 Dec 7, 2024
0.5.1 May 13, 2024
0.5.0 Apr 17, 2024
0.4.1 May 8, 2023
0.1.2 Nov 5, 2022

#106 in Debugging

Download history 1501/week @ 2024-08-23 1860/week @ 2024-08-30 1558/week @ 2024-09-06 2197/week @ 2024-09-13 1957/week @ 2024-09-20 1901/week @ 2024-09-27 1713/week @ 2024-10-04 2006/week @ 2024-10-11 2307/week @ 2024-10-18 2391/week @ 2024-10-25 1682/week @ 2024-11-01 1365/week @ 2024-11-08 1613/week @ 2024-11-15 2057/week @ 2024-11-22 1991/week @ 2024-11-29 2827/week @ 2024-12-06

8,687 downloads per month
Used in 10 crates

MIT license

15KB
139 lines

📡 Dioxus Logger 🛰️

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


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


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.

Dependencies

~1.3–1.8MB
~27K SLoC