more linting

flush-on-exit
Gareth Jones 11 years ago
parent 40ec9e98e4
commit 516320c79a

@ -1,6 +1,8 @@
"use strict";
function Level(level, levelStr) { function Level(level, levelStr) {
this.level = level; this.level = level;
this.levelStr = levelStr; this.levelStr = levelStr;
} }
/** /**
@ -13,55 +15,54 @@ function Level(level, levelStr) {
function toLevel(sArg, defaultLevel) { function toLevel(sArg, defaultLevel) {
if (!sArg) { if (!sArg) {
return defaultLevel; return defaultLevel;
} }
if (typeof sArg == "string") { if (typeof sArg == "string") {
var s = sArg.toUpperCase(); var s = sArg.toUpperCase();
if (module.exports[s]) { if (module.exports[s]) {
return module.exports[s]; return module.exports[s];
} else { } else {
return defaultLevel; return defaultLevel;
} }
} }
return toLevel(sArg.toString()); return toLevel(sArg.toString());
}
};
Level.prototype.toString = function() { Level.prototype.toString = function() {
return this.levelStr; return this.levelStr;
}; };
Level.prototype.isLessThanOrEqualTo = function(otherLevel) { Level.prototype.isLessThanOrEqualTo = function(otherLevel) {
if (typeof otherLevel === "string") { if (typeof otherLevel === "string") {
otherLevel = toLevel(otherLevel); otherLevel = toLevel(otherLevel);
} }
return this.level <= otherLevel.level; return this.level <= otherLevel.level;
}; };
Level.prototype.isGreaterThanOrEqualTo = function(otherLevel) { Level.prototype.isGreaterThanOrEqualTo = function(otherLevel) {
if (typeof otherLevel === "string") { if (typeof otherLevel === "string") {
otherLevel = toLevel(otherLevel); otherLevel = toLevel(otherLevel);
} }
return this.level >= otherLevel.level; return this.level >= otherLevel.level;
}; };
Level.prototype.isEqualTo = function(otherLevel) { Level.prototype.isEqualTo = function(otherLevel) {
if (typeof otherLevel == "string") { if (typeof otherLevel == "string") {
otherLevel = toLevel(otherLevel); otherLevel = toLevel(otherLevel);
} }
return this.level === otherLevel.level; return this.level === otherLevel.level;
} };
module.exports = { module.exports = {
ALL: new Level(Number.MIN_VALUE, "ALL") ALL: new Level(Number.MIN_VALUE, "ALL"),
, TRACE: new Level(5000, "TRACE") TRACE: new Level(5000, "TRACE"),
, DEBUG: new Level(10000, "DEBUG") DEBUG: new Level(10000, "DEBUG"),
, INFO: new Level(20000, "INFO") INFO: new Level(20000, "INFO"),
, WARN: new Level(30000, "WARN") WARN: new Level(30000, "WARN"),
, ERROR: new Level(40000, "ERROR") ERROR: new Level(40000, "ERROR"),
, FATAL: new Level(50000, "FATAL") FATAL: new Level(50000, "FATAL"),
, OFF: new Level(Number.MAX_VALUE, "OFF") OFF: new Level(Number.MAX_VALUE, "OFF"),
, toLevel: toLevel toLevel: toLevel
}; };

Loading…
Cancel
Save