From: Tj Holowaychuk Date: Thu, 5 Aug 2010 17:47:26 +0000 (-0700) Subject: Added console.trace() X-Git-Tag: v0.1.104~34 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e8795cea30436aad5b88b6885c60b543b35c4162;p=platform%2Fupstream%2Fnodejs.git Added console.trace() --- diff --git a/src/node.js b/src/node.js index 8c5b3a0..a5d8d07 100644 --- a/src/node.js +++ b/src/node.js @@ -247,6 +247,16 @@ global.console.timeEnd = function(label){ global.console.log('%s: %dms', label, duration); }; +global.console.trace = function(label){ + // 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 = label || ''; + Error.captureStackTrace(err, arguments.callee); + console.error(err.stack); +}; + global.console.assert = function(expression){ if(!expression){ var arr = Array.prototype.slice.call(arguments, 1);