Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const initLogger = (isDev = false) => {
app.setAppLogsPath()
const logBasePath = app.getPath('logs')
const fileOutStream = (title: string) => createWriteStream(`${logBasePath}/${app.name}.${title}.log`, { flags: 'a' })
const devlogs = isDev ? [
{ level: 'trace', stream: pinoms.prettyStream() },
{ level: 'trace', stream: fileOutStream('trace') }
] : []
const lg: Logger = pinoms({
streams: [
...devlogs,
{ level: 'info', stream: fileOutStream('info') },
{ level: 'warn', stream: fileOutStream('warn') },
{ level: 'error', stream: fileOutStream('error') },
{ level: 'fatal', stream: fileOutStream('fatal') }
]
}) as Logger
const master = lg.child({ ver: app.getVersion() })
const main = master.child({ platform: 'electron-main' })
const rdr = master.child({ platform: 'electron-renderer' })