Skip to content

Commit

Permalink
Support of console.dir + console.assert
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromeetienne authored and ry committed Jul 7, 2010
1 parent 0bceaaa commit 8e9f59a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,17 @@ global.console.warn = function () {

global.console.error = global.console.warn;

global.console.dir = function(object){
var sys = module.requireNative('sys');
process.stdout.write(sys.inspect(object) + '\n');
}

global.console.assert = function(expression){
if(!expression){
var arr = Array.prototype.slice.call(arguments, 1);
process.assert(false, format.apply(this, arr));
}
}

process.exit = function (code) {
process.emit("exit");
Expand Down

0 comments on commit 8e9f59a

Please sign in to comment.