How to use the pino-multi-stream 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 rolling-scopes / rsschool-app / server / src / logger.ts View on Github external
export function createDefaultLogger() {
  const streams = [{ stream: process.stdout }];
  const { accessKeyId, secretAccessKey, region } = config.aws;
  if (process.env.NODE_ENV === 'production' && accessKeyId && secretAccessKey) {
    const writeStream = cloudwatch({
      interval: 2000,
      aws_access_key_id: accessKeyId,
      aws_secret_access_key: secretAccessKey,
      aws_region: region,
      group: '/app/rsschool-api',
    });
    streams.push(writeStream);
  }
  return pinoLogger({ streams, base: null }) as ILogger;
}

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