Update app.js

This commit is contained in:
Namhyeon Go 2021-04-29 16:49:36 +09:00
parent d5f7114f55
commit 4fb8beb948

15
app.js
View File

@ -44,6 +44,7 @@ var exit = function(status) {
};
var console = {
_timers: {},
_messages: [],
_join: function(args, sep) {
args = args || [];
@ -85,6 +86,20 @@ var console = {
},
debug: function() {
this._echo(arguments, "debug");
},
time: function(label) {
this._timers[label] = new Date();
},
timeLog: function(label, end) {
if (label in this._timers) {
console.debug(label + ": " + ((new Date()).getTime() - this._timers[label].getTime()) + "ms" + (end ? " - timer ended" : ""));
}
},
timeEnd: function(label) {
if (label in this._timers) {
this.timeLog();
delete this._timers[label];
}
}
};