From e562544807b196dafac9195ea8137958698755e5 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sat, 9 Sep 2023 14:09:48 +0200 Subject: Add logging for web in tour example --- examples/tour/src/main.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'examples/tour/src/main.rs') diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs index af508206..f0e3c0cd 100644 --- a/examples/tour/src/main.rs +++ b/examples/tour/src/main.rs @@ -8,6 +8,13 @@ use iced::widget::{Button, Column, Container, Slider}; use iced::{Color, Element, Font, Length, Renderer, Sandbox, Settings}; 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(); Tour::run(Settings::default()) -- cgit