I\'d like to see a nice log with short info about each request to my server, for use during development. I\'ve seen the documentation on http://hapijs.com/api#request-logs, but
In Hapi.js version above v17, please make the below changes to make it work:
server.events.on('response', function (request) {
// you can use request.log or server.log it's depends
server.log(request.info.remoteAddress + ': ' + request.method.toUpperCase() + ' ' + request.url.path + ' --> ' + request.response.statusCode);
});
The log will be:
127.0.0.1: GET /todo --> 200