Trait quick_js::console::ConsoleBackend [−][src]
A console backend that handles console messages sent from JS via console.{log,debug,trace,…} functions.
A backend has to be registered via the ContextBuilder::console
method.
A backend that forwads to the log
crate is available with the log
feature.
Note that any closure of type Fn(Level, Vec<JsValue>)
implements this trait.
A very simple logger that just prints to stderr could look like this:
use quick_js::{Context, JsValue, console::Level}; Context::builder() .console(|level: Level, args: Vec<JsValue>| { eprintln!("{}: {:?}", level, args); }) .build()
Required methods
Loading content...Implementors
impl ConsoleBackend for LogConsole
[src]
impl<F> ConsoleBackend for F where
F: Fn(Level, Vec<JsValue>) + RefUnwindSafe + 'static,
[src]
F: Fn(Level, Vec<JsValue>) + RefUnwindSafe + 'static,