Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
}