configure now takes a filename or object

This commit is contained in:
csausdev
2011-01-16 13:21:37 +11:00
parent c6dd2398ab
commit a876dfbe9c
2 changed files with 31 additions and 10 deletions

View File

@@ -242,7 +242,25 @@ vows.describe('log4js').addBatch({
delete messages['tmp-test.log'];
log4js.configure('test/with-log-rolling.json');
assert.equal(messages.watchedFile, 'tmp-test.log');
}
},
'should handle an object or a file name': function(args) {
var log4js = args[0],
messages = args[1],
config = {
"appenders": [
{
"type" : "file",
"filename" : "cheesy-wotsits.log",
"maxLogSize" : 1024,
"backups" : 3,
"pollInterval" : 15
}
]
};
delete messages['cheesy-wotsits.log'];
log4js.configure(config);
assert.equal(messages.watchedFile, 'cheesy-wotsits.log');
}
},
'with no appenders defined' : {