How to use the pino-multi-stream.prettyStream function in pino-multi-stream

To help you get started, we’ve selected a few pino-multi-stream examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github patrickmichalina / fusing-angular / src / electron / log.ts View on Github external
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' })

pino-multi-stream

A wrapper for the Pino logger that provides Bunyan's multipe destination stream API

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis