fi_common/logger.rs
1#[cfg(feature = "wasm")]
2use wasm_bindgen::prelude::wasm_bindgen;
3
4#[cfg(feature = "wasm")]
5#[wasm_bindgen]
6extern "C" {
7 #[wasm_bindgen(js_namespace = console)]
8 pub fn log(value: &str);
9 #[wasm_bindgen(js_namespace = console)]
10 pub fn error(value: &str);
11}
12
13#[cfg(not(feature = "wasm"))]
14#[allow(dead_code)]
15pub fn log(value: &str) {
16 println!("{}", value);
17}
18#[cfg(not(feature = "wasm"))]
19pub fn error(value: &str) {
20 eprintln!("{}", value);
21}