1.2.0 • Published 10 years ago

hapi-bunyan-plugin v1.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

Hapi Bunyan Plugin

Integrates bunyan with Hapi.js by wiring a bunyan Logger instance into the published server events.

Allows structured json logging of the Hapi.Server generated log messages. Using server.log() and request.log() will be routed through the bunyan Logger as well.

Usage

var Hapi = require('hapi'),
    HapiBunyan = require('hapi-bunyan'),
    bunyan = require('bunyan');

var server = new Hapi.Server(),
    log = bunyan.createLogger({
        name: 'my-application',
        level: 'debug'
    });

server.connection({ port: 8000 });

server.register({
    register: HapiBunyan,
    options: {
        log: log
    }
});

// other server configuration, routes, etc.

server.start();

Configuration

The options object used when registering the plugin takes the following properties:

  • log - the bunyan Logger instance. (required)
  • logInternal - boolean value, defaults to false. Set to true to enable logging of Hapi.Server internal events.

License

MIT. See LICENSE.txt.

1.2.0

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago