mirror of
https://github.com/log4js-node/log4js-node.git
synced 2025-12-08 19:26:01 +00:00
fix(#501): don't break when objects are weird
This commit is contained in:
parent
0b402ca275
commit
3de180710d
@ -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);
|
||||
}
|
||||
|
||||
@ -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();
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user