constructor(appliName) { this.appliName = appliName || 'rasa-ui'; this.logFormat = winston.format.printf(info => { const formattedDate = info.timestamp.replace('T', ' ').replace('Z', ''); return `${formattedDate}|${this.appliName}|${info.level}|${ info.message };`; }); this.winston = winston.createLogger({ level: global.loglevel || 'info', format: winston.format.combine( winston.format.timestamp(), this.logFormat ), transports: [new winston.transports.Console({})] }); }
function createLogger() { var level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'warn'; return createWinstonLogger({ format: combine(printf(function (info) { return getFormatedDate() + ' - ' + colorLevel(info.level) + ' ' + info.message; })), level: level, transports: createTransports() }); }
createLogger({ level: process.env.NODE_ENV === 'development' ? 'debug' : 'info', transports: [new winston.transports.Console()], format: format.combine( format.timestamp(), format.colorize(), format.simple(), format.printf(info => `${info.timestamp} ${info[MESSAGE]}`), ), silent: config.logger.disabled, })
winston.format.combine( winston.format.colorize({ all: true }), winston.format.printf( info => { return `[${info.timestamp}] [express-logger] [${info.level}] [expressRequestId=${info.expressRequestId}]: ${info.message}` } ) )
winston.format.combine( winston.format.colorize({ all: true }), winston.format.printf( msg => { return `[${msg.timestamp}] [${msg.filename}] [${msg.level}] [expressRequestId=${msg.expressRequestId}]: ${msg.message}` } ) )