Where can I find the logs for my Electron app in production?

后端 未结 2 1177
萌比男神i
萌比男神i 2021-02-13 03:47

I\'ve built an app with Electron and used Electron-Builder to create a Squirrel windows installer and updater. It all works great but I\'m having trouble debugging the productio

2条回答
  •  野性不改
    2021-02-13 04:43

    Old question, but I found convenient to configure this in package.json (this applies to console from the main process)

     "main": "app/src/main.js",
      "scripts": {
        "postinstall": "install-app-deps",
        "start": "npm install && electron . > /tmp/electron-app.log",
        "pack": "build --dir",
        "dist": "build",
        "dist:win": "build --platform win32",
        "dist:linux": "build --platform linux"
      }
    

    You might elaborate it a little, like getting the /tmp/ path from somewhere, but you get the idea :)

    I would advice over the accepted answer, and in general about constantly calling "main" from the renderer: The overhead of this context change is rather big, and can even be huge if you log JSON objects that have to be stringified and parsed back in the trip. Your renderer will be running with a handbrake!

提交回复
热议问题