node.js中的console.trace方法使用说明
网络编程
方法说明:
向标准错误流输出当前的调用栈。
语法:
console.trace(label)
接收参数:
label
例子:
console.trace(); //运行结果: Trace: at Object.<anonymous> (/home/byvoid/consoletrace.js : 1: 71) 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)
源码:
Console.prototype.trace = function() { // TODO probably can to do this better with V8's debug object once that is // exposed. var err = new Error; err.name = 'Trace'; err.message = util.format.apply(this, arguments); Error.captureStackTrace(err, arguments.callee); this.error(err.stack); };
node.js中的console.info方法使用说明
方法说明:该方法与console.log()相同。从源码看,它是直接调用console.log的。语法:console.info([data],[...])接收参数:接受若干个参数,如果只有一个参数,
node.js中的console.warn方法使用说明
方法说明:该方法与console.error()相同。看源码就知道,console.error其实就是直接调用console.warn的语法:console.warn([data],[...])接收参数:console.log接受若干个
node.js中的console.log方法使用说明
方法说明:向标准输出流打印字符并以换行符结束。语法:console.log([data],[...])接收参数:console.log接受若干个参数,如果只有一个参数,则输出这个参
标签:方法,参数,语法,使用说明,若干个