emmenko/sphere-node-connect — pull request #2 by emmenko (2014-02-09 21:46:26+00:00)
Title: Enable debugging

@svenmueller @hajoeichler please have a look.

My idea is:
- you can activate the **verbose** mode by passing the option `verbose` when instantiating a `OAuth2` or `Rest` object
- the response of [`request`](https://github.com/mikeal/request) containing info about request/response will be logged using the `npmlog` package

We can then apply the same configuration to the other packages (e.g.: node-client, node-cli). As they will all "share" the same configuration it will be just a matter of setting the flag to enabling debug.

This is what it will look like

```bash
http CONNECT request ====================>
http URI { protocol: 'https:',
http URI slashes: true,
http URI auth: 'S6AD07quPeeTfRoOHXdTx2NZ:7d3xSWTN5jQJNpnRnMLd4qICmfahGPka',
http URI host: 'auth.sphere.io',
http URI port: 443,
http URI hostname: 'auth.sphere.io',
http URI hash: null,
http URI search: null,
http URI query: null,
http URI pathname: '/oauth/token',
http URI path: '/oauth/token',
http URI href: 'https://S6AD07quPeeTfRoOHXdTx2NZ:7d3xSWTN5jQJNpnRnMLd4qICmfahGPka@auth.sphere.io/oauth/token' }
http Method POST
http Headers { 'Content-Type': 'application/x-www-form-urlencoded',
http Headers 'Content-Length': 59,
http Headers authorization: 'Basic UzZBRDA3cXVQZWVUZlJvT0hYZFR4Mk5aOjdkM3hTV1RONWpRSk5wblJuTUxkNHFJQ21mYWhHUGth' }
http CONNECT response ====================>
http Status 200
http Headers { server: 'nginx',
http Headers date: 'Sun, 09 Feb 2014 21:45:47 GMT',
http Headers 'content-type': 'application/json; charset=utf-8',
http Headers 'transfer-encoding': 'chunked',
http Headers connection: 'keep-alive',
http Headers pragma: 'no-cache',
http Headers 'cache-control': 'no-store',
http Headers 'x-served-by': 'app3.sphere.prod.commercetools.de',
http Headers 'x-served-config': 'sphere-auth-ws-1.0' }
http Body {"access_token":"0YK4ncUCyOVInKWz_a2WXoB5uI8oSmtW","token_type":"Bearer","expires_in":172800,"scope":"manage_project:nicola"}
```