Comparing version
@@ -5,2 +5,6 @@ | ||
exports.setUp = function (done) { | ||
Logger._instance = null; | ||
done(); | ||
}; | ||
@@ -108,1 +112,41 @@ exports.testDefaultLogLevel = function(test) { | ||
}; | ||
exports.testFineEvent = function(test) { | ||
var logger = new Logger('test'); | ||
var rootLogger = Logger.getSingleton(); | ||
var records = { | ||
global: [], | ||
fine: [], | ||
test: [] | ||
} | ||
rootLogger.on('', function (record) { | ||
records.global.push(record) | ||
}) | ||
rootLogger.on(LogLevel.FINE, function (record) { | ||
records.fine.push(record) | ||
}) | ||
rootLogger.on('test', function (record) { | ||
records.test.push(record) | ||
}) | ||
logger.fine('hello'); | ||
test.equal(0, records.global.length); | ||
test.equal(1, records.fine.length); | ||
test.equal(1, records.test.length); | ||
logger.finer('hello'); | ||
test.equal(0, records.global.length); | ||
test.equal(1, records.fine.length); | ||
test.equal(2, records.test.length); | ||
logger.info('hello'); | ||
test.equal(1, records.global.length); | ||
test.equal(1, records.fine.length); | ||
test.equal(3, records.test.length); | ||
test.done(); | ||
}; |
@@ -189,10 +189,9 @@ /** | ||
// | ||
// * Emit on global key from rootLogger. | ||
// * Emit on global key from rootLogger if the event is loggable. | ||
// * Emit a LEVEL event on the rootLogger | ||
// * For each name in the ancestor chain, emit an event of that name. | ||
if (!this.isLoggable(level)) { | ||
return | ||
if (this.isLoggable(level)) { | ||
rootLogger.emit('', logRecord); | ||
} | ||
rootLogger.emit('', logRecord); | ||
rootLogger.emit(level, logRecord); | ||
@@ -199,0 +198,0 @@ |
{ | ||
"name" : "logg", | ||
"version" : "0.3.3", | ||
"version" : "0.3.4", | ||
"description" : "Logging library that allows for hierarchical loggers, multiple log levels, and flexible watching of log records.", | ||
@@ -5,0 +5,0 @@ "keywords" : ["log", "logging", "logger", "hierarchical", "handler", "watcher"], |
28962
3.44%675
5.3%