All tests pass, moved appenders into separate files, so that extra ones can be added easily

This commit is contained in:
Gareth Jones
2011-07-26 08:52:40 +10:00
parent 545681287f
commit ef9fe3a4b1
7 changed files with 276 additions and 139 deletions
+6 -11
View File
@@ -102,29 +102,24 @@ vows.describe('log4js layouts').addBatch({
error = new Error("Some made-up error"),
stack = error.stack.split(/\n/);
event.data = ['this is a test', error];
event.data = ['this is a test ', error];
output = layout(event);
lines = output.split(/\n/);
assert.length(lines, stack.length+1);
assert.equal(lines[0], "[2010-12-05 14:18:30.045] [DEBUG] tests - this is a test");
assert.equal(lines[1], "Error: Some made-up error");
assert.length(lines, stack.length);
assert.equal(lines[0], "[2010-12-05 14:18:30.045] [DEBUG] tests - this is a test Error: Some made-up error");
for (var i = 1; i < stack.length; i++) {
assert.equal(lines[i+1], stack[i]);
assert.equal(lines[i+1], stack[i+1]);
}
},
'should output any extra data in the log event as util.inspect strings': function(args) {
var layout = args[0], event = args[1], output, lines;
event.data = ['this is a test', {
event.data = ['this is a test ', {
name: 'Cheese',
message: 'Gorgonzola smells.'
}];
output = layout(event);
lines = output.split(/\n/);
assert.length(lines, 2);
assert.equal(lines[0], "[2010-12-05 14:18:30.045] [DEBUG] tests - this is a test");
assert.equal(lines[1], "{ name: 'Cheese', message: 'Gorgonzola smells.' }");
assert.equal(output, "[2010-12-05 14:18:30.045] [DEBUG] tests - this is a test { name: 'Cheese', message: 'Gorgonzola smells.' }");
}
},