import config from 'lib/Config'; import bunyan, { Stream } from 'bunyan'; import Loggly from 'bunyan-loggly'; const streams: Stream[] = [ { level: config.debug ? 'trace' : config.env === 'development' ? 'debug' : 'info', stream: process.stdout }, ]; if (config.vendors.loggly.api_key) { const loggly_stream = new Loggly( { token: '43b08a2c-f7c1-4c0e-bb2e-125bed056044', subdomain: 'nextgenleads', }, 5, 2000 ); streams.push({ level: 'info', stream: loggly_stream, type: 'raw', }); } export const Log = bunyan.createLogger({ name: config.app.name, // eslint-disable-next-line no-nested-ternary level: config.debug ? 'trace' : config.env === 'development' ? 'debug' : 'info', streams, }); export default Log;