theduke / quickjs-rs

Rust wrapper for the quickjs Javascript engine.
MIT License
570 stars 48 forks source link

Add full logging example #108

Open vedantroy opened 3 years ago

vedantroy commented 3 years ago

Using

 let ctx = Context::builder().console(quick_js::console::LogConsole).build()?;

and later I evaluate some code that uses console.log, the code will run but nothing will be printed.

theduke commented 3 years ago

Hey.

The provided logger uses the log crate, which doesn't print anything by default.

You will have to enable a logging backend.

env-logger is a popular choice.

theduke commented 3 years ago

We should probably add a full example that demonstrates logging.