방법 설명 :
현재 통화 스택을 표준 오류 스트림으로 출력하십시오.
문법:
코드 사본은 다음과 같습니다.
Console.Trace (레이블)
매개 변수 수신 :
상표
예:
코드 사본은 다음과 같습니다.
Console.Trace ();
// 실행 결과 :
추적하다:
at object.
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 ATRAY.0 (Module.JS : 479 : 10)
at Eventemitter._tickCallback (node.js : 192 : 40)
소스 코드 :
코드 사본은 다음과 같습니다.
console.prototype.trace = function () {
// TODO는 아마도 V8의 디버그 객체로 더 잘할 수 있습니다.
// 노출된.
var err = 새로운 오류;
err.name = '추적';
err.message = util.format.apply (this, arguments);
error.capturestacktrace (err, arguments.callee);
this.error (err.stack);
};