A few customized serializers for the bunyan logging framework
JavaScript
Switch branches/tags
Nothing to show
Latest commit 5170c81 Jun 18, 2016 @kesla kesla committed on GitHub Merge pull request #1 from michaeltarleton/patch-1
Update README.md
Permalink
Failed to load latest commit information.
test CODE Dec 18, 2012
.gitignore Initial commit Dec 18, 2012
README.md Update README.md Jun 17, 2016
package.json 0.0.2 Jan 27, 2014
serializers.js CODE Dec 18, 2012

README.md

bunyan-serializers

Some customized serializers for bunyan.

example

    var serializers = require('bunyan-serializers');
    var bunyan = require('bunyan');

    var logger = bunyan.createLogger({
        serializers: serializers,
        stream: process.stdout,
        name: 'test'
    });

    var server = http.createServer(function(req, res) {
        logger.info({req: req, res: res}, 'Got a request and a response');
    });
    server.listen(8080);

differences from bunyan.stdSerializers.

In the standard serializer for bunyan the req- and res-objects are serialized when creating a child-logger, like

    var child = bunyan.child({
        req: reqObj,
        res: resObj
    });

This means that if the reqObj or resObj get changed after the child has been initated those changes will not be logged properly. The serializers for req and res-objects are in this project not serialized when a child is created but rather when you actually log.

A serializer for an err-object is also attached for completeness.