fixed a bug where if the first log arg was not a string it wouldn't get logged
This commit is contained in:
parent
ec21ec63f0
commit
4b32456db7
@ -41,6 +41,9 @@ function formatLogData(logData) {
|
||||
if (data.length > 0) {
|
||||
output += '\n';
|
||||
}
|
||||
} else {
|
||||
//put it back, it's not a format string
|
||||
data.unshift(format);
|
||||
}
|
||||
|
||||
data.forEach(function (item) {
|
||||
|
@ -65,7 +65,19 @@ vows.describe('log4js layouts').addBatch({
|
||||
, toString: function() { return "ERROR"; }
|
||||
}
|
||||
}), "thing 1");
|
||||
}
|
||||
},
|
||||
'should output the first item even if it is not a string': function(layout) {
|
||||
assert.equal(layout({
|
||||
data: [ { thing: 1} ]
|
||||
, startTime: new Date(2010, 11, 5, 14, 18, 30, 45)
|
||||
, categoryName: "cheese"
|
||||
, level: {
|
||||
colour: "green"
|
||||
, toString: function() { return "ERROR"; }
|
||||
}
|
||||
}), "{ thing: 1 }");
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
'basicLayout': {
|
||||
|
Loading…
Reference in New Issue
Block a user