wasm-bindgen-console-logger

Crates.iowasm-bindgen-console-logger
lib.rswasm-bindgen-console-logger
version0.1.1
sourcesrc
created_at2019-01-01 03:21:56.324851
updated_at2019-01-24 06:33:11.178416
descriptionA simple backend for the log crate that sends messages to the Web browser's console
homepage
repositoryhttps://github.com/blm768/wasm-bindgen-console-logger
max_upload_size
id104789
size6,009
Ben Merritt (blm768)

documentation

README

wasm-bindgen-console-logger

This small utility crate integrates the log crate with the JavaScript console logging functions with the help of wasm-bindgen.

Example

use log::{error, info, warn};
use wasm_bindgen::prelude::*;
use wasm_bindgen_console_logger::DEFAULT_LOGGER;

#[wasm_bindgen]
pub fn start() {
    log::set_logger(&DEFAULT_LOGGER).unwrap();
    log::set_max_level(log::LevelFilter::Info);

    error!("Error message");
    warn!("Warning message");
    info!("Informational message");
}

Related libraries

By sheer coincidence, this crate was published at almost exactly the same time as console_log. Assuming that it receives continued maintenance, console_log may end up being the "go-to" option for logging in WebAssembly applications, but I'm planning to provide at least basic maintenance on this crate until the situation becomes clearer.

Commit count: 6

cargo fmt