终于能够准确定位各种行号了
callback 位置, emit 位置
test.js
require('myconsole').replace();
var EventEmitter = require('events').EventEmitter;
var emitter = new EventEmitter();
/* 4 */ emitter.on('error', console.ifError);
/* 5 */ var err = new Error('error from emitter');
/* 6 */ emitter.emit('error', err);
输出:
[test.js:4] at [test.js:6] : Error: error from emitter
at Object.<anonymous> (...../test.js:5:11)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)
at Array.0 (module.js:479:10)
at EventEmitter._tickCallback (node.js:192:40)