hyperion/20-dev/00-rust/wasm rust (frontend dioxus leptos)/logger.md
2025-11-22 17:48:07 +03:00

46 lines
No EOL
846 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

```rust
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" }
}
}
```
```rust
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" }
}
}
```
```rust
fn main() {
// Включает стандартный форматер с временем в UTC
tracing_subscriber::fmt::init();
tracing::info!("Это сообщение будет с временной меткой.");
}
```
https://crates.io/crates/dioxus-logger