Baphomet is the dedicated bot for nulloctet matrix
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

55 lines
1.4 KiB

let winston = require('winston');
require('winston-daily-rotate-file');
let errorTransport = new (winston.transports.DailyRotateFile)({
level: 'error',
filename: 'log/error-%DATE%.log',
datePattern: 'YYYY-MM-DD',
zippedArchive: true,
maxFiles: '7d'
});
let combinedTransport = new (winston.transports.DailyRotateFile)({
filename: 'log/combined-%DATE%.log',
datePattern: 'YYYY-MM-DD',
zippedArchive: true,
maxFiles: '7d'
});
let logger = winston.createLogger({
level: 'info',
format: winston.format.combine(
winston.format.timestamp(),
winston.format.splat(),
winston.format.simple()
),
defaultMeta: { service: 'baphomet-js' },
transports: [
errorTransport,
combinedTransport
]
});
if (process.env.NODE_ENV !== 'production') {
logger.add(new winston.transports.Console({
format: winston.format.combine(
winston.format.colorize(),
winston.format.simple()
)
}));
} else {
logger.add(new winston.transports.Console({
level: 'error',
format: winston.format.combine(
winston.format.colorize(),
winston.format.simple()
)
}));
}
if ('LOG_LEVEL' in process.env) {
logger.info('LOG_LEVEL: %s', process.env.LOG_LEVEL)
logger.level = process.env.LOG_LEVEL
}
export { logger };