How to use the pino-sentry.createWriteStream function in pino-sentry

To help you get started, we’ve selected a few pino-sentry 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 ethereum-optimism / optimism / packages / core-utils / src / common / logger.ts View on Github external
this.options = options

    const loggerOptions: PinoLoggerOptions = {
      name: options.name,

      level: options.level || 'debug',

      // Remove pid and hostname considering production runs inside docker
      base: null,
    }

    let loggerStreams: Streams = [{ stream: process.stdout }]
    if (options.sentryOptions) {
      loggerStreams.push({
        level: 'error',
        stream: createWriteStream({
          ...options.sentryOptions,
          stackAttributeKey: 'err',
        }),
      })
    }
    if (options.streams) loggerStreams = loggerStreams.concat(options.streams)

    this.inner = pino(loggerOptions, pinoms.multistream(loggerStreams))
  }

pino-sentry

@sentry/node transport for pino logger

MIT
Latest version published 2 months ago

Package Health Score

75 / 100
Full package analysis

Popular pino-sentry functions