Enabling IPC from renderer in prod
Apologies if I'm missing something obvious, but I'm having a tough time figuring out how to enable the IPC transport from the renderer in a packaged application.
Setting the log level for the IPC transport in the renderer doesn't appear to work.
Make sure you've set level for both main and renderer side
This doesn't appear to make a difference for me. In main (main.ts):
logger.transports.file.level = 'silly';
(logger.transports.ipc as any).level = 'silly';
const log = logger.scope('main');
In renderer (main.tsx):
(logger.transports.ipc as any).level = 'silly';
logger.catchErrors({
showDialog: false,
onError: (e) => {
logger.error(e);
},
});
const log = logger.scope('ui');
Is there anything else I could try?
having the same issue, does anyone have a hint of what's the easiest way to get electronLog to log the console from the renderer process ? it used to be as simple as:
console.log = electronLog.log;
Object.assign(console, electronLog.functions);
but with IPC you cannot pass objects directly or you get an Error: An object could not be cloned (as it should). Does that mean we cannot easily redirect console.log anymore or is there a trick?
@Zhell1 you've passed some type of object restricted by Structured Clone Algorithm. In the next version of electron-log such a type will be stringified.
In v5 logs from a renderer process are always displayed in the main console.
@Zhell1 you've passed some type of object restricted by Structured Clone Algorithm. In the next version of electron-log such a type will be stringified.
I'm using 5.0.0-beta.25, and have same error when I use "console.log". Is this fixed or not yet ?
@cnhuye Could you provide an example?