Add logging for web in tour example
This commit is contained in:
parent
9c2ad457d8
commit
e562544807
2 changed files with 12 additions and 0 deletions
|
|
@ -9,8 +9,13 @@ publish = false
|
||||||
iced.workspace = true
|
iced.workspace = true
|
||||||
iced.features = ["image", "debug"]
|
iced.features = ["image", "debug"]
|
||||||
|
|
||||||
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
tracing-subscriber = "0.3"
|
tracing-subscriber = "0.3"
|
||||||
|
|
||||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
iced.workspace = true
|
iced.workspace = true
|
||||||
iced.features = ["image", "debug", "webgl"]
|
iced.features = ["image", "debug", "webgl"]
|
||||||
|
|
||||||
|
console_error_panic_hook = "0.1"
|
||||||
|
console_log = "1.0"
|
||||||
|
log.workspace = true
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,13 @@ use iced::widget::{Button, Column, Container, Slider};
|
||||||
use iced::{Color, Element, Font, Length, Renderer, Sandbox, Settings};
|
use iced::{Color, Element, Font, Length, Renderer, Sandbox, Settings};
|
||||||
|
|
||||||
pub fn main() -> iced::Result {
|
pub fn main() -> iced::Result {
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
{
|
||||||
|
console_log::init_with_level(log::Level::Debug).expect("Initialize logger");
|
||||||
|
std::panic::set_hook(Box::new(console_error_panic_hook::hook));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
tracing_subscriber::fmt::init();
|
tracing_subscriber::fmt::init();
|
||||||
|
|
||||||
Tour::run(Settings::default())
|
Tour::run(Settings::default())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue