fix logging for non-string values

The error is that you are converting the returned value to an object, but that could be anything.

In the crashing case `console.log(5)` it's a number.

So we convert any object to string rep before setting the output text.