@aantthony/logger 中文文档教程
logger
简单的 console.log
替换。
npm install --save @aantthony/logger
Usage
var log = require('logger')('Login');
// 9720ms Login: Hello World!
log.info('Hello World!');
Disable output
require('logger').setOutputStream(null);
Collect log data:
require('logger').on('data', function (payload) {
// { component: 'Login',
// time: Thu Jun 18 2015 23:09:29 GMT+1000 (AEST),
// hostname: 'Anthony.local',
// level: 'info',
// message: 'Hello World!',
// pid: 46297,
// data: undefined }
console.log(payload);
});
logger
Simple console.log
replacement.
npm install --save @aantthony/logger
Usage
var log = require('logger')('Login');
// 9720ms Login: Hello World!
log.info('Hello World!');
Disable output
require('logger').setOutputStream(null);
Collect log data:
require('logger').on('data', function (payload) {
// { component: 'Login',
// time: Thu Jun 18 2015 23:09:29 GMT+1000 (AEST),
// hostname: 'Anthony.local',
// level: 'info',
// message: 'Hello World!',
// pid: 46297,
// data: undefined }
console.log(payload);
});