#wasm #front-end #logger #console #log


A logger that sends a message with its Rust source’s line and filename to the browser console

6 releases

✓ Uses Rust 2018 edition

0.1.5 Jun 16, 2019
0.1.4 Jun 12, 2019
0.1.3 Apr 13, 2019
0.1.2 Feb 15, 2019
0.1.0 Oct 4, 2018

#68 in WebAssembly

Download history 8/week @ 2019-04-04 21/week @ 2019-04-11 20/week @ 2019-04-18 9/week @ 2019-04-25 12/week @ 2019-05-02 7/week @ 2019-05-09 12/week @ 2019-05-16 10/week @ 2019-05-23 18/week @ 2019-05-30 17/week @ 2019-06-06 50/week @ 2019-06-13 28/week @ 2019-06-20 32/week @ 2019-06-27 49/week @ 2019-07-04 22/week @ 2019-07-11

60 downloads per month


135 lines


A logger that sends a message with its Rust source's line and filename to the browser console.


In v0.1.4 and up, the default Config will put the message on the same line as other info (see more). If you want them on a separate line as the screenshot above, you must config like this:



Note: For more information about how to use loggers in Rust, see log.


log = "0.4.6"
wasm-logger = "0.1.5"

Initialize wasm-logger when your app start:


// Logging
log::info!("Some info");
log::error!("Error message");

Log for a specific module only

You can provide a path prefix:

wasm_logger::init(wasm_logger::Config::with_prefix(log::Level::Debug, "some::module"));

then, wasm-logger only logs message from some::module

Mapping from log to console's methods

log::error!, log::warn! and log::info! call theirs equivalent methods of the browser console. The console.trace method outputs some extra trace from the generated JS glue code which we don't want. Therefore, we choose to map:

  • log::debug! to console.log
  • log::trace! to console.debug.

Note for Chromium/Chrome users

Chromium/Chrome filters out console.debug (execute by log::trace!) by default. You must check the Verbose filter in your browser console to see trace entries.


MIT or Apache-2.0


~38K SLoC