Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information