Changed toLevel to accept a Log4js.Level (or in fact any object), and try to convert it to a Log4js.Level. Fixes the setLevel asymmetry, where you cannot setLevel(log4js.level.foo)
This commit is contained in:
+7
-2
@@ -5,7 +5,7 @@ function Level(level, levelStr) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* converts given String to corresponding Level
|
* converts given String to corresponding Level
|
||||||
* @param {String} sArg String value of Level
|
* @param {String} sArg String value of Level OR Log4js.Level
|
||||||
* @param {Log4js.Level} defaultLevel default Level, if no String representation
|
* @param {Log4js.Level} defaultLevel default Level, if no String representation
|
||||||
* @return Level object
|
* @return Level object
|
||||||
* @type Log4js.Level
|
* @type Log4js.Level
|
||||||
@@ -21,8 +21,13 @@ function toLevel(sArg, defaultLevel) {
|
|||||||
if (module.exports[s]) {
|
if (module.exports[s]) {
|
||||||
return module.exports[s];
|
return module.exports[s];
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
return defaultLevel;
|
return defaultLevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return toLevel(sArg.toString());
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Level.prototype.toString = function() {
|
Level.prototype.toString = function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user