pino-err-serializerdeprecated

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

Usage no npm install needed!

<script type="module">
  import pinoErrSerializer from 'https://cdn.skypack.dev/pino-err-serializer';
</script>

README

pino-err-serializer

NPM version Downloads Build Status Coverage Status Dependency status Dev Dependency status

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.

Installation

$ npm install pino-err-serializer

Usage

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!');

Tests

$ npm test
$ npm test-cov to get coverage report

License

Released under the MIT License.