Skip to content

modelo/MODELO_log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Log library for MODELO backend servers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published