How to use the config function from winston

Find comprehensive JavaScript winston.config code examples handpicked from public code repositorys.

20
21
22
23
24
25
26
27
28
29
30
31
process.env.NODE_ENV = 'development';


const filename = path.join('./', 'combined.log');


const logger = winston.createLogger({
  levels: winston.config.syslog.levels,
  format: winston.format.combine(winston.format.colorize(), winston.format.timestamp({format: 'YYYY-MM-DD HH:mm:ss'}), winston.format.printf(info => `${info.timestamp} ${info.level}: ${info.message}`)),
  transports: [
    new winston.transports.File({
      filename: filename,
fork icon0
star icon0
watch icon1

+ 20 other calls in file

73
74
75
76
77
78
79
80
81
82
83
84


		let message = ts + ' ' + level + ': ' + (undefined !== options.message ? options.message : '') +
			(options.meta && Object.keys(options.meta).length ? '\n\t' + util.inspect(options.meta) : '');


		if (options.colorize === 'all') {
			return winston.config.colorize(options.level, message);
		}
		return message;
	}
}
fork icon0
star icon0
watch icon1