mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-06 15:04:58 +00:00
Update app.js
This commit is contained in:
parent
4fb8beb948
commit
a04978b130
21
app.js
21
app.js
|
@ -45,6 +45,7 @@ var exit = function(status) {
|
|||
|
||||
var console = {
|
||||
_timers: {},
|
||||
_counters: {},
|
||||
_messages: [],
|
||||
_join: function(args, sep) {
|
||||
args = args || [];
|
||||
|
@ -88,18 +89,36 @@ var console = {
|
|||
this._echo(arguments, "debug");
|
||||
},
|
||||
time: function(label) {
|
||||
this._timers[label] = new Date();
|
||||
label = label || "default";
|
||||
if (!(label in this._timers)) {
|
||||
this._timers[label] = new Date();
|
||||
}
|
||||
},
|
||||
timeLog: function(label, end) {
|
||||
label = label || "default";
|
||||
if (label in this._timers) {
|
||||
console.debug(label + ": " + ((new Date()).getTime() - this._timers[label].getTime()) + "ms" + (end ? " - timer ended" : ""));
|
||||
}
|
||||
},
|
||||
timeEnd: function(label) {
|
||||
label = label || "default";
|
||||
if (label in this._timers) {
|
||||
this.timeLog();
|
||||
delete this._timers[label];
|
||||
}
|
||||
},
|
||||
count: function(label) {
|
||||
label = label || "default";
|
||||
if (!(label in this._counters)) {
|
||||
this._counters[label] = 1;
|
||||
}
|
||||
},
|
||||
countReset: function(label) {
|
||||
label = label || "default";
|
||||
if (label in this._counters) {
|
||||
this.timeLog();
|
||||
delete this._counters[label];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user