square/retrofit — pull request #577 by danrice-square (2014-07-29 14:26:29+00:00)
Title: Add a new log level: HEADERS_AND_ARGS

@JakeWharton

This adds an additional log level that logs the request args and response body directly (via toString()). This is useful for logging binary formats such as protocol buffers where converting the serialized byte stream to a String is not appropriate.

An example log might look like:

```
---> HTTP POST http://example.com/
Foo: Bar
Content-Type: text/plain; charset=UTF-8
Content-Length: 2
---> REQUEST:
#0: TypedString[Hi]
---> END HTTP (2-byte body)
<--- HTTP 200 http://example.com/ \\([0-9]+ms\\)
Content-Type: application/json
Content-Length: 42
<--- END HTTP (2-byte body)
<--- BODY:
{}
```

These lines are new:

```
---> REQUEST:
#0: TypedString[Hi]

<--- BODY:
{}
```