diff --git a/packages/fxa-auth-server/package.json b/packages/fxa-auth-server/package.json index b3b24a0b68..d1a7f958aa 100644 --- a/packages/fxa-auth-server/package.json +++ b/packages/fxa-auth-server/package.json @@ -25,7 +25,8 @@ "hoek": "0.8.5", "uuid": "1.4.1", "async": "0.2.8", - "kvstore": "git://github.com/mozilla/node-kvstore.git#4b8c2f6763" + "kvstore": "git://github.com/mozilla/node-kvstore.git#4b8c2f6763", + "good": "0.5.7" }, "devDependencies": { "awsbox": "0.4.x", diff --git a/packages/fxa-auth-server/server.js b/packages/fxa-auth-server/server.js index b03e566d41..123f85ad57 100644 --- a/packages/fxa-auth-server/server.js +++ b/packages/fxa-auth-server/server.js @@ -34,6 +34,30 @@ server.ext( } ); +server.ext('onPreResponse', function (request, next) { + var response = request.response(); + if (response.isBoom) { + server.log(['error'], + response.response.code + ' ' + + response.response.payload.error + ': ' + + response.message); + server.log(['info'], 'request payload: ' + JSON.stringify(request.payload)); + } + + next(); +}); + +server.pack.require('good', { + subscribers: { + console: ['ops', 'request', 'log'] + }, + extendedRequests: true, + leakDetection: true + }, + function(err) { + if (err) server.log(['error'], err); + }); + //TODO throttle extension //TODO toobusy extension