0.0.8 • Published 7 years ago

modelo-log v0.0.8

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

modelo-log is a quick wrap of winston for our use in modelo

Install

npm install modelo-log

Features

  1. customize output ways (to console or/and log file)
  2. Save daily logs to ${process.cwd()}/logs/hostIp-date.txt; sample filename: 10.10.11.11-2016-10-08.txt

util functions

  • filterSensitive()

    var logger = require('modelo-log');
    logger.filterSensitive({username: abc, password: abcdefg, credit: '4564188001337578'})
    // return {username: abc, password: ******, credit: '************7578'}

Sample usage

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}

Note

The first argument represent TAG of the log

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago

0.0.0

8 years ago