Any way to hook onto every Ion request on a global level? -
i'm using ion async http library android , i'd custom logging. ideal hook onto every reqest start , end in order total request time , other meta data http response code , url. know of way this?
i'm experimenting setasynchttprequestfactory
, seems allow hook onto request begin, not end.
ion.config ionconf = ion.getdefault(appcontext).configure(); final asynchttprequestfactory reqfac = ionconf.getasynchttprequestfactory(); ionconf.setasynchttprequestfactory((uri, method, headers) -> { // custom logging stuff here asynchttprequest req = reqfac.createasynchttprequest(uri, method, headers); return req; });
implement , add asynchttpclientmiddleware (inherit simplemiddleware) , inject asynchttpclient's pipeline. override onrequest , onresponsecompleted events start , end of request.
or, if enable ion logging globally, can see request time, , sorts of metadata in adb logcat.
Comments
Post a Comment