nodejs tracer 模块实现日志跟踪

来源:互联网 发布:des算法加解密过程 编辑:程序博客网 时间:2024/06/05 12:04

转自:https://github.com/baryon/tracer

 

var logger = require('tracer').console();logger.log('hello');logger.trace('hello', 'world');logger.debug('hello %s',  'world', 123);logger.info('hello %s %d',  'world', 123, {foo:'bar'});logger.warn('hello %s %d %j', 'world', 123, {foo:'bar'});logger.error('hello %s %d %j', 'world', 123, {foo:'bar'}, [1, 2, 3, 4], Object);var loggerColor = require('tracer').colorConsole();loggerColor.log('hello');loggerColor.trace('hello', 'world');loggerColor.debug('hello %s',  'world', 123);loggerColor.info('hello %s %d',  'world', 123, {foo:'bar'});loggerColor.warn('hello %s %d %j', 'world', 123, {foo:'bar'});loggerColor.error('hello %s %d %j', 'world', 123, {foo:'bar'}, [1, 2, 3, 4], Object);var filelogger = require('tracer').dailyfile({root:'.'});filelogger.log('hello');filelogger.trace('hello', 'world');filelogger.debug('hello %s',  'world', 123);filelogger.info('hello %s %d',  'world', 123, {foo:'bar'});filelogger.warn('hello %s %d %j', 'world', 123, {foo:'bar'});filelogger.error('hello %s %d %j', 'world', 123, {foo:'bar'}, [1, 2, 3, 4], Object);


 

0 0
原创粉丝点击