Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default (config: FactoryConfig): any => {
const testEnv = process.env.NODE_ENV === 'test';
if (!testEnv && config.type === 'loggly') {
winston.add(new loggly.Loggly(config.loggly));
}
// only errors during testing to allow debugging
const consoleOptions = testEnv ? { level: 'error' } : {};
winston.add(new winston.transports.Console(consoleOptions));
return winston;
};