bjrmatos/jsreport-electron-pdf

Debug logs from console

pofider opened this issue ยท 7 comments

jsreport includes debug extension which can collect logs associated with particular rendering request and response them back to the caller. This is for example used in combination with phantom-pdf recipe which forwards all the phantomjs messages and also user's console.log calls into this log which is usually displayed in the jsreport studio.

It would be nice to have the similar functionality in this recipe. Would it be possible?

blog post introducing debug extension
http://jsreport.net/blog/debug-extension

writing to request logs
https://github.com/jsreport/jsreport-phantom-pdf/blob/master/lib/phantom.js#L159

overriding console
https://github.com/pofider/phantom-html-to-pdf/blob/master/lib/scripts/logScriptPart.js

yes, i think it is possible, i will give it a look on the weekend ๐Ÿ˜„

done in v2.3.0

Thank you.

I've tried it. The console.log is nicely propagated. However the phantom-pdf recipe still gives us more details. Not sure if this is possible with electron, but it would be great to see this info:

  • info if I link a css or image and electron fails to load it because of invalid url
  • info if my js script throws for some reason

This is demonstrated on this example:
https://playground.jsreport.net/studio/workspace/ZJZMyHgm2e/140

In every case please put to the log at the beginning what strategy and what electron version is used. This helps a lot when troubleshooting so we don't have to explicitly ask users.

sure, i will take a look on how to add that information

ok, i've done a little of research and found that electron added new APIs that really facilitates the capture of this information and other things in the implementation. (i'm not sure but maybe with the changes i've made the package could run on iisnode, and maybe this time electron will not take 100% of CPU on windows when using ipc/server strategies (the link points to an older version) ๐Ÿค”)

these changes are in v2.4.1 ๐ŸŽ‰ ๐Ÿ˜„

captura de pantalla 2017-02-18 a las 11 41 24 p m

Debug works great in playground now. Thanks!

I didn't check it with iisnode yet, I'm busy with other things, lets see in time...