hapi-pino
Hapi plugin for the Pino logger. It logs in JSON for easy
post-processing.
It is faster than good console logger by a 25%
factor (40% when using extreme
mode
Install
npm i hapi-pino --save
Usage
'use strict'
const Hapi = require('hapi')
const server = new Hapi.Server()
server.connection({
host: 'localhost',
port: 3000
})
server.register({
register: require('pino').register,
options: {
extreme: true
}
}, (err) => {
if (err) {
throw err
}
})
server.route({
method: 'GET',
path: '/',
handler: function (request, reply) {
request.logger.info('a word from the handler')
return reply('hello world')
}
})
server.start((err) => {
if (err) {
throw err
}
server.app.logger.info('logging with Pino')
})
Acknowledgements
This project was kindly sponsored by nearForm.
License
MIT