fixed a bug where if the first log arg was not a string it wouldn't get logged
This commit is contained in:
@@ -41,6 +41,9 @@ function formatLogData(logData) {
|
|||||||
if (data.length > 0) {
|
if (data.length > 0) {
|
||||||
output += '\n';
|
output += '\n';
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
//put it back, it's not a format string
|
||||||
|
data.unshift(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
data.forEach(function (item) {
|
data.forEach(function (item) {
|
||||||
|
|||||||
@@ -65,7 +65,19 @@ vows.describe('log4js layouts').addBatch({
|
|||||||
, toString: function() { return "ERROR"; }
|
, toString: function() { return "ERROR"; }
|
||||||
}
|
}
|
||||||
}), "thing 1");
|
}), "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': {
|
'basicLayout': {
|
||||||
|
|||||||
Reference in New Issue
Block a user