fixed missing space between log data elements

This commit is contained in:
Gareth Jones
2011-09-15 08:18:24 +10:00
parent 12e71bda4e
commit 9a34d9edfd
2 changed files with 7 additions and 4 deletions

View File

@@ -44,6 +44,9 @@ function formatLogData(logData) {
} }
data.forEach(function (item) { data.forEach(function (item) {
if (output) {
output += ' ';
}
if (item && item.stack) { if (item && item.stack) {
output += item.stack; output += item.stack;
} else { } else {

View File

@@ -57,14 +57,14 @@ vows.describe('log4js layouts').addBatch({
}, },
'should support the console.log format for the message' : function(layout) { 'should support the console.log format for the message' : function(layout) {
assert.equal(layout({ assert.equal(layout({
data: ["thing %d", 1] data: ["thing %d", 1, "cheese"]
, startTime: new Date(2010, 11, 5, 14, 18, 30, 45) , startTime: new Date(2010, 11, 5, 14, 18, 30, 45)
, categoryName: "cheese" , categoryName: "cheese"
, level : { , level : {
colour: "green" colour: "green"
, toString: function() { return "ERROR"; } , toString: function() { return "ERROR"; }
} }
}), "thing 1"); }), "thing 1 'cheese'");
}, },
'should output the first item even if it is not a string': function(layout) { 'should output the first item even if it is not a string': function(layout) {
assert.equal(layout({ assert.equal(layout({
@@ -102,7 +102,7 @@ vows.describe('log4js layouts').addBatch({
error = new Error("Some made-up error"), error = new Error("Some made-up error"),
stack = error.stack.split(/\n/); stack = error.stack.split(/\n/);
event.data = ['this is a test ', error]; event.data = ['this is a test', error];
output = layout(event); output = layout(event);
lines = output.split(/\n/); lines = output.split(/\n/);
@@ -114,7 +114,7 @@ vows.describe('log4js layouts').addBatch({
}, },
'should output any extra data in the log event as util.inspect strings': function(args) { 'should output any extra data in the log event as util.inspect strings': function(args) {
var layout = args[0], event = args[1], output, lines; var layout = args[0], event = args[1], output, lines;
event.data = ['this is a test ', { event.data = ['this is a test', {
name: 'Cheese', name: 'Cheese',
message: 'Gorgonzola smells.' message: 'Gorgonzola smells.'
}]; }];