I'm using the Ion async HTTP library for Android and I'd like to do some custom logging. What would be ideal was to hook onto every reqest start and end in order to get the total request time and some other meta data like HTTP response code and URL. Anyone know of any way to do this?
I'm experimenting with setAsyncHttpRequestFactory
, but that only seems to allow be too hook onto request begin, not end.
Ion.Config ionConf = Ion.getDefault(appContext).configure();
final AsyncHttpRequestFactory reqFac = ionConf.getAsyncHttpRequestFactory();
ionConf.setAsyncHttpRequestFactory((uri, method, headers) -> {
// Do custom logging stuff here
AsyncHttpRequest req = reqFac.createAsyncHttpRequest(uri, method, headers);
return req;
});