1pub mod prelude;
6
7use crate::prelude::trace;
8use limnus_app::prelude::{App, Plugin};
9
10pub struct LogPlugin;
13
14impl Plugin for LogPlugin {
15 fn build(&self, _app: &mut App) {
16 init_logger();
17 trace!("log plugin started");
18 }
19}
20
21#[cfg(not(target_arch = "wasm32"))]
22pub fn init_logger() {
23 tracing_subscriber::fmt()
24 .with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
25 .with_writer(std::io::stderr)
26 .init();
27}
28
29#[cfg(target_arch = "wasm32")]
30use tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt;
31#[cfg(target_arch = "wasm32")]
32use tracing_subscriber::util::SubscriberInitExt;
33
34#[cfg(target_arch = "wasm32")]
35pub fn init_logger() {
36 tracing_subscriber::registry()
37 .with(tracing_wasm::WASMLayer::new(
38 tracing_wasm::WASMLayerConfig::default(),
39 ))
40 .init();
41}