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
So I found a way:
server.events.on('response', function (request) {
console.log(request.info.remoteAddress + ': ' + request.method.toUpperCase() + ' ' + request.path + ' --> ' + request.response.statusCode);
});
The log then looks like this:
127.0.0.1: GET /myEndpoint/1324134?foo=bar --> 200
127.0.0.1: GET /sgsdfgsdrh --> 404
Answer edited for Hapi v18, see older versions here