NOTE: This module is deprecated because it has been merged into pino
!
An improved error serializer for pino that not only logs the error type, message and stack but also other properties set on the error object.
$ npm install pino-err-serializer
const pino = require('pino');
const errSerializer = require('pino-err-serializer');
const logger = pino({
serializers: {
err: errSerializer,
},
});
logger.info({
err: Object.assign(new Error('Some error'), { this: 'will be serialized' })
}, 'An error occurred!');
$ npm test
$ npm test-cov
to get coverage report
Released under the MIT License.