diff --git a/src/lib/log.js b/src/lib/log.js index 664ea3b14..64c0692c2 100644 --- a/src/lib/log.js +++ b/src/lib/log.js @@ -182,7 +182,7 @@ Log.parseLevels = function (input) { Log.join = function (arrayish) { return _.map(arrayish, function (item) { if (_.isPlainObject(item)) { - return _.inspect(item) + '\n'; + return JSON.stringify(item, null, 2) + '\n'; } else { return item.toString(); } diff --git a/test/unit/specs/log.js b/test/unit/specs/log.js index 8976c01bd..345938864 100644 --- a/test/unit/specs/log.js +++ b/test/unit/specs/log.js @@ -97,7 +97,13 @@ describe('Log class', function () { expect(Log.join(['foo', 'bar'])).to.eql('foo bar'); }); it('stringifies objects', function () { - expect(Log.join([{ foo: 'bar' }])).to.eql('{ foo: \'bar\' }\n'); + expect(Log.join([{ foo: 'bar' }])).to.eql('{\n "foo": "bar"\n}\n'); + }); + + it('fully stringifies deeply nested objects', function() { + var object = { foo: { bar: { baz: 'value' } } }; + var expected = '{\n "bar": {\n "baz": "value"\n }\n}\n'; + expect(Log.join(object)).to.eql(expected); }); });