frankhale / electron-with-express

A simple app that demonstrates spawning an Express app from Electron
MIT License
643 stars 147 forks source link

console.log() doesn't work #18

Closed pourabk-hexaware closed 5 years ago

pourabk-hexaware commented 5 years ago

console.log() , window.console.log(), they don't work both in client-side js as well as in node. Is there some other logging implementation to be used? Cannot see any logs here.

frankhale commented 5 years ago

When the Express server starts up the output is redirected and captured inside the Electron app. The README says press the F1 key to see the output. The code is in index.html [this should really be moved out at some point to it's own JavaScript file so as to not clutter up the index.html]. Another thing to note about this is that with recent versions of Chromium the behavior of key bindings has changed slightly. Before you used to be able to set a keybinding on a page that embeds a webview and everything was nice, keybindings worked. Now keybindings are weird and do not work properly when the webview gains focus (eg. the parent page key bindings are ignored until the parent is focused).

That being said, a quick Google search produces the following module for additional ways to log output in a Electron app: https://www.npmjs.com/package/electron-log

I don't do any sort of special logging in any of my apps so don't have a good answer to your question. This is a very common question asked by so many people and Google is filled with info.