README
du-node-tracer
dueros node tracer
usage
- init: 按照顺序一条中排序 内部使用log4js配置 tracer.initLog(require('./conf/log4js_config')[env], 'app');
let t = new tracer('dcs-utils', req.logid, [ { key: logid, default: '-' }, { key:path }, { key:request, } ]);
- 单条打印:
t.debug('request:%j', req.body);
- 收集日志 最终一条输出:
t.gather('path', req.path.toLowerCase()); t.gather('client_ip', req.ip); t.gather('header', req.headers); t.gather('pv_lost', 0); t.dumps();
- global use tracer.debug('logid:%s request:%j', this.logid, req.body);