Skip to content

Commit fd7add3

Browse files
authored
wasm: log output to browser JavaScript console (#163)
Logging from the `log` facade goes to the colorized in-game GUI console (opened with the backtick key), as well as standard output using `println!` on the native build. To make this work on the wasm build, web-sys is used to access the `console` object, to call `console.log`, `console.warn`, and so on corresponding to the log levels. Extends #92, fails later (see also #115) but now outputs the starting up message: [main.rs:206][INFO] Starting steven * Add println! logging to console.log on wasm * Initialize logger before config (called 'console variables' for some reason) to avoid having to disable it to reach the first logging statement * Add web-sys crate for browser console access, wasm32-only * Refactor logger to call println_level on both web/native * Add multiple log levels, console.warn etc., matching console_log crate https://github.com/iamcodemaker/console_log#details
1 parent fd028d4 commit fd7add3

File tree

4 files changed

+158
-26
lines changed

4 files changed

+158
-26
lines changed

0 commit comments

Comments
 (0)