fix(#501): don't break when objects are weird

This commit is contained in:
Gareth Jones 2017-07-14 08:50:41 +10:00
parent 0b402ca275
commit 3de180710d
2 changed files with 10 additions and 1 deletions

View File

@ -84,7 +84,7 @@ module.exports = function (levels, getLevelForCategory, setLevelForCategory) {
}
_log(level, data) {
debug(`sending log data (${level}, ${data}) to appenders`);
debug(`sending log data (${level}) to appenders`);
const loggingEvent = new LoggingEvent(this.category, level, data, this.context);
this.dispatch(loggingEvent);
}

View File

@ -120,5 +120,14 @@ test('../../lib/logger', (batch) => {
t.end();
});
batch.test('should not break when log data has no toString', (t) => {
const logger = new Logger(dispatch, 'thing');
logger.info('Just testing ', Object.create(null));
const events = testDispatcher.events;
t.equal(events.length, 1);
t.end();
});
batch.end();
});