diff --git a/spec/spec.logging.js b/spec/spec.logging.js index 7f3ef99..0b91e5a 100644 --- a/spec/spec.logging.js +++ b/spec/spec.logging.js @@ -138,26 +138,6 @@ describe 'log4js' end - describe 'logLevelFilter' - - it 'should only pass log events greater than or equal to its own level' - var logEvent; - log4js.addAppender(log4js.logLevelFilter('ERROR', function(evt) { logEvent = evt; })); - logger.debug('this should not trigger an event'); - logEvent.should.be undefined - - logger.warn('neither should this'); - logEvent.should.be undefined - - logger.error('this should, though'); - logEvent.should.not.be undefined - logEvent.message.should.be 'this should, though' - - logger.fatal('so should this') - logEvent.message.should.be 'so should this' - end - - end end diff --git a/test/logging.js b/test/logging.js index 9b58b04..8fd9d8a 100644 --- a/test/logging.js +++ b/test/logging.js @@ -327,6 +327,25 @@ vows.describe('log4js').addBatch({ } }, + 'logLevelFilter': { + topic: function() { + var log4js = require('../lib/log4js')(), logEvents = [], logger; + log4js.clearAppenders(); + log4js.addAppender(log4js.logLevelFilter('ERROR', function(evt) { logEvents.push(evt); })); + logger = log4js.getLogger(); + logger.debug('this should not trigger an event'); + logger.warn('neither should this'); + logger.error('this should, though'); + logger.fatal('so should this'); + return logEvents; + }, + 'should only pass log events greater than or equal to its own level' : function(logEvents) { + assert.length(logEvents, 2); + assert.equal(logEvents[0].message, 'this should, though'); + assert.equal(logEvents[1].message, 'so should this'); + } + }, + 'Date extensions': { topic: function() { require('../lib/log4js');