From 5f2f8fcb3099df78371c60c6eba50d596ac20749 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Wed, 20 Jun 2018 10:20:00 +0100 Subject: [PATCH] chore: add debug logging to http server Sets up Hapi's debug logging when DEBUG env var is present. This will enable developers to see what is happening inside the daemon when ipfs/js-ipfsd-ctl#270 is merged instead of just getting error messages like 'Please retrace your steps'. It lets you do this sort of thing: ``` $ DEBUG=ipfsd-ctl:daemon:* npm test ``` ...and see Hapi's request/server logs in the output. --- src/http/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/http/index.js b/src/http/index.js index 93a5ec172e..d15f1375b0 100644 --- a/src/http/index.js +++ b/src/http/index.js @@ -100,7 +100,11 @@ function HttpApi (repo, config, cliArgs) { routes: { cors: true } - } + }, + debug: process.env.DEBUG ? { + request: ['*'], + log: ['*'] + } : undefined }) this.server.app.ipfs = this.node