node.js中的console.trace方法使用说明
方法说明:
向标准错误流输出当前的调用栈。
语法:
console.trace(label)
接收参数:
label
例子:
console.trace();
//运行结果:
Trace:
atObject.<anonymous>(/home/byvoid/consoletrace.js:1:71)
atModule._compile(module.js:441:26)
atObject..js(module.js:459:10)
atModule.load(module.js:348:31)
atFunction._load(module.js:308:12)
atArray.0(module.js:479:10)
atEventEmitter._tickCallback(node.js:192:40)
源码:
Console.prototype.trace=function(){
//TODOprobablycantodothisbetterwithV8'sdebugobjectoncethatis
//exposed.
varerr=newError;
err.name='Trace';
err.message=util.format.apply(this,arguments);
Error.captureStackTrace(err,arguments.callee);
this.error(err.stack);
};
热门推荐
2 红丝绒戚风蛋糕
3 夹心小甜点
4 南瓜甜点
6 粘米粉蒸蛋糕
7 酸奶华夫饼
9 红柚鸡蛋糕
10 葡萄干蛋糕
11 紫薯蛋糕卷
13 纸杯裱花小蛋糕
14 果酱奶酪蛋糕
15 日式樱花蔓越莓大福
16 草莓蛋糕卷
17 卡仕达长崎杯子蛋糕