Skip to content

Commit

Permalink
Don't use console.error (#1984)
Browse files Browse the repository at this point in the history
Because it can apparaently cause crashes:
emilk/egui#2961
  • Loading branch information
emilk authored and jleibs committed May 2, 2023
1 parent 2f9bc25 commit 51a5e06
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions crates/re_log/src/web_logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ impl log::Log for WebLogger {
log::Level::Debug => console::debug(&msg),
log::Level::Info => console::info(&msg),
log::Level::Warn => console::warn(&msg),
log::Level::Error => console::error(&msg),

// Using console.error causes crashes for unknown reason
// https://github.com/emilk/egui/pull/2961
// log::Level::Error => console::error(&msg),
log::Level::Error => console::warn(&format!("ERROR: {msg}")),
}
}

Expand Down Expand Up @@ -60,8 +64,10 @@ mod console {
#[wasm_bindgen(js_namespace = console)]
pub fn warn(s: &str);

/// `console.error`
#[wasm_bindgen(js_namespace = console)]
pub fn error(s: &str);
// Using console.error causes crashes for unknown reason
// https://github.com/emilk/egui/pull/2961
// /// `console.error`
// #[wasm_bindgen(js_namespace = console)]
// pub fn error(s: &str);
}
}

0 comments on commit 51a5e06

Please sign in to comment.