pixelkind / p5canvas

An interactive preview for writing p5js code in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=garrit.p5canvas
Other
39 stars 4 forks source link

How to view JavaScript console output? #18

Closed osteele closed 4 years ago

osteele commented 5 years ago

The following sketch causes text to appear in a web browser's (e.g. Safari, Chrome) JavaScript Console.

Is there a way to see what's written when it runs inside p5canvas?

I've run into this as in issue in a couple of different places. First, when using console.info etc. to print values during debugging. This can be worked around with via the p5js text() function, although the workaround has some deficiencies. Secondly, when a runtime error prevents the sketch from running, it appears to be necessary to run it in a browser to see the console output, in order to diagnose the issue.

function setup() {
    console.info("Hello world!");
}
pixelkind commented 5 years ago

Hej Oliver,

console.info("") is currently not supported, but console.log("") should work. Also the setup function is needed by the p5canvas extension so that method can not be used. I will add console.info("") in one of the next releases.

I hope that solves your problem.

pixelkind commented 4 years ago

This issue will be fixed in the next version