- black
- red
- green
- yellow
- blue
- magenta
- cyan
- white
- gray
- grey
var winston = require('winston'); var transportConsole = new winston.transports.Console({ json: false, timestamp: true, prettyPrint:true, colorize: true }); var logger = new (winston.Logger)({ levels: { info: 0, warn: 1, error: 2, verbose: 3, i: 4, db: 5 }, transports: [ transportConsole ] }); winston.addColors({ info: 'green', warn: 'cyan', error: 'red', verbose: 'blue', i: 'gray', db: 'magenta' }); logger.i('iiiii foobar level-ed message'); logger.db('dbbbbb foobar level-ed message'); logger.info('infoo foobar level-ed message'); logger.warn('warnnnn foobar level-ed message'); logger.error('errroor foobar level-ed message'); module.exports = logger;
Ekran görüntüsü: