Add logging for web in tour example

This commit is contained in:
Thomas 2023-09-09 14:09:48 +02:00
parent 9c2ad457d8
commit e562544807
2 changed files with 12 additions and 0 deletions

View file

@ -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())