Added console.{time,timeEnd}()
This commit is contained in:
parent
e15221a8de
commit
a8e1e8d057
12
src/node.js
12
src/node.js
@ -235,7 +235,17 @@ global.console.error = global.console.warn;
|
|||||||
global.console.dir = function(object){
|
global.console.dir = function(object){
|
||||||
var sys = module.requireNative('sys');
|
var sys = module.requireNative('sys');
|
||||||
process.stdout.write(sys.inspect(object) + '\n');
|
process.stdout.write(sys.inspect(object) + '\n');
|
||||||
}
|
};
|
||||||
|
|
||||||
|
var times = {};
|
||||||
|
global.console.time = function(label){
|
||||||
|
times[label] = Date.now();
|
||||||
|
};
|
||||||
|
|
||||||
|
global.console.timeEnd = function(label){
|
||||||
|
var duration = Date.now() - times[label];
|
||||||
|
global.console.log('%s: %dms', label, duration);
|
||||||
|
};
|
||||||
|
|
||||||
global.console.assert = function(expression){
|
global.console.assert = function(expression){
|
||||||
if(!expression){
|
if(!expression){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user