The console. trace Method in node. js is used in node. js scenarios.
Method description:
Outputs the current call stack to the standard error stream.
Syntax:
Copy codeThe Code is as follows:
Console. trace (label)
Receiving parameters:
Label
Example:
Copy codeThe Code is as follows:
Console. trace ();
// Running result:
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)
Source code:
Copy codeThe Code is as follows:
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 = 'track ';
Err. message = util. format. apply (this, arguments );
Error. captureStackTrace (err, arguments. callee );
This. error (err. stack );
};