megahertz / electron-log

Simple logging module Electron/Node.js/NW.js application. No dependencies. No complicated configuration.
MIT License
1.27k stars 124 forks source link

How to output renderer log to custom filePath #410

Closed heelaine closed 3 months ago

heelaine commented 3 months ago

i suppose to output the log in the renderer to a custom file, attempting to use IPC channel, but the log is being output to the main.log file. How can I customize the log file path in the rendering process? // main.ts import log from 'electron/main' log.initialize({spyRenderedConsole:true}) log.transports.file.resolvePathFn = ()=>{ return join(path,'main.log')}

// renderer.ts ipcRenderer.send('__ELECTRON_LOG__',{ data: 'test', level:'info', })

if i create logger instances,how to assign renderer instances to output log file path?