Skip to content

Commit 8e9f59a

Browse files
jeromeetiennery
authored andcommittedJul 7, 2010
Support of console.dir + console.assert
1 parent 0bceaaa commit 8e9f59a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
 

‎src/node.js

+11
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,17 @@ global.console.warn = function () {
220220

221221
global.console.error = global.console.warn;
222222

223+
global.console.dir = function(object){
224+
var sys = module.requireNative('sys');
225+
process.stdout.write(sys.inspect(object) + '\n');
226+
}
227+
228+
global.console.assert = function(expression){
229+
if(!expression){
230+
var arr = Array.prototype.slice.call(arguments, 1);
231+
process.assert(false, format.apply(this, arr));
232+
}
233+
}
223234

224235
process.exit = function (code) {
225236
process.emit("exit");

0 commit comments

Comments
 (0)
Please sign in to comment.