diff --git a/lib/log4js.js b/lib/log4js.js index 298bd16..46e7bab 100644 --- a/lib/log4js.js +++ b/lib/log4js.js @@ -265,14 +265,25 @@ function LoggingEvent (categoryName, level, message, exception, logger) { */ function Logger (name, level) { this.category = name || DEFAULT_CATEGORY; - this.level = Level.toLevel(level, levels.TRACE); + + if (! this.level) { + this.setLevel('TRACE'); + } } sys.inherits(Logger, events.EventEmitter); Logger.prototype.setLevel = function(level) { + this.__proto__.level = Level.toLevel(level, levels.TRACE); +}; + +Logger.prototype.setLocalLevel = function(level) { this.level = Level.toLevel(level, levels.TRACE); }; +Logger.prototype.removeLocalLevel = function() { + delete this.level; +}; + Logger.prototype.log = function(logLevel, message, exception) { var loggingEvent = new LoggingEvent(this.category, logLevel, message, exception, this); this.emit("log", loggingEvent);