mirror of https://github.com/BTCPrivate/copay.git
Clearer iteration through keys
- We needed to closure the variable `levels` and this is cleaner
This commit is contained in:
parent
6520f8c5e6
commit
4415f1c862
|
@ -14,8 +14,7 @@ var levels = {
|
|||
'fatal': 5
|
||||
};
|
||||
|
||||
for (_level in levels) {
|
||||
(function(level) {
|
||||
Object.keys(levels).forEach(function(level) {
|
||||
Logger.prototype[level] = function() {
|
||||
if (levels[level] >= levels[this.level]) {
|
||||
var str = '[' + level + '] ' + this.name + ': ' + arguments[0],
|
||||
|
@ -32,8 +31,7 @@ for (_level in levels) {
|
|||
}
|
||||
}
|
||||
};
|
||||
})(_level);
|
||||
}
|
||||
});
|
||||
|
||||
Logger.prototype.setLevel = function(level) {
|
||||
this.level = level;
|
||||
|
|
Loading…
Reference in New Issue