working, except for tests which expect log levels to persist across getLogger calls

This commit is contained in:
Gareth Jones
2013-08-02 15:12:04 +10:00
parent 3b55aefe6f
commit 5bd7ce3ab9
4 changed files with 24 additions and 19 deletions

View File

@@ -57,16 +57,13 @@ vows.describe('../lib/logger').addBatch({
},
'log': {
topic: new Logger('testing'),
'should send log events to log4js': function(logger) {
var evt, original = log4js.dispatch;
log4js.dispatch = function(event) {
evt = event;
};
topic: function() {
var evt
, logger = new Logger('testing', null, function(event) { evt = event; });
logger.log(levels.DEBUG, "cheese");
log4js.dispatch = original;
return evt;
},
'should send log events to log4js': function(evt) {
assert.equal(evt.categoryName, 'testing');
assert.equal(evt.level, levels.DEBUG);
assert.equal(evt.data[0], "cheese");

View File

@@ -54,6 +54,7 @@ vows.describe('log4js').addBatch({
'log events' : {
topic: function(logger) {
var events = [];
var log4js = require('../lib/log4js');
log4js.addAppender(function (logEvent) { events.push(logEvent); }, "tests");
logger.debug("Debug event");
logger.trace("Trace event 1");