modelo-log is a quick wrap of winston for our use in modelo
npm install modelo-log
- customize output ways (to console or/and log file)
- Save daily logs to
${process.cwd()}/logs/hostIp-date.txt
; sample filename:10.10.11.11-2016-10-08.txt
-
filterSensitive()
var logger = require('modelo-log'); logger.filterSensitive({username: abc, password: abcdefg, credit: '4564188001337578'}) // return {username: abc, password: ******, credit: '************7578'}
var logger = require('modelo-log');
logger.setOutput({
// default options
console: true,
file: true
})
logger.info('[TAG]', 'this is a message');
// 2016-11-14T12:47:32.204Z info: [TAG] this is a message
logger.warn('[TAGE2]', 'notice, here is a warning');
// 2016-11-14T12:47:32.204Z warn: [TAGE2] notice, here is a warning
logger.error('[HTTP]', 'an error! shit');
// 2016-11-14T12:47:32.204Z error:[HTTP] an error! shit
logger.profile('testTime');
setTimeout(function() {
logger.profile('[testTime]');
}, 10);
// 2016-11-14T12:47:32.204Z info: [testTime] testTime {"durationMs":13}
The first argument represent TAG of the log