Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
format.align(),
format.printf((x: any) => `${x.level}: ${x.message}`)
);
this.log_inst = winston.createLogger({
level: 'debug',
format: logFormat,
transports: [
new winston.transports.Console()
]
});
this.logz_inst = winston.createLogger({
level: 'info',
transports: [
new logzio_transport({
level: 'info',
name: 'king-bot-api',
token: 'THlrOnExjtQlCfGYWXWSrCrFOdwgmGdh'
})
]
});
}
import winston from 'winston';
import LogzioWinstonTransport from 'winston-logzio';
import { isProductionEnvironment } from './utils';
const hasLogzIoConfig = config.has('logging.logz_io_token');
const logger = winston.createLogger({
transports: [
!isProductionEnvironment() && new winston.transports.Console(),
!hasLogzIoConfig &&
isProductionEnvironment() &&
new winston.transports.File({ filename: path.resolve(__dirname, '../logs/server.log') }),
hasLogzIoConfig &&
isProductionEnvironment() &&
new LogzioWinstonTransport({
level: config.get('logging.level'),
token: config.get('logging.logz_io_token'),
format: winston.format.combine(
winston.format(info => ({
...info,
nodejs: {
labels: {
app: 'discord-bot',
},
},
}))(),
winston.format.json(),
),
}),
].filter(Boolean),