I think you can easily log out to the browser console.
I believe hooking up a debugger to your IDE is also possible. I haven’t tried it yet though: https://emscripten.org/docs/porting/Debugging.html?
Maybe I’ll give it a go and write about it in my next post.