bjrmatos / jsreport-electron-pdf

jsreport recipe which renders pdf from html using electron :rocket:
MIT License
53 stars 6 forks source link

Debug logs from console #12

Closed pofider closed 7 years ago

pofider commented 7 years ago

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

bjrmatos commented 7 years ago

yes, i think it is possible, i will give it a look on the weekend 😄

bjrmatos commented 7 years ago

done in v2.3.0

pofider commented 7 years ago

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:

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

pofider commented 7 years ago

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.

bjrmatos commented 7 years ago

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

bjrmatos commented 7 years ago

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
pofider commented 7 years ago

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...