android - Retrofit2 HttpLoggingInterceptor Logcat -


probably novice question i'm wondering catch logs in log cat. there particular place put log, special regex use etc. interceptor looks like:

httplogginginterceptor interceptor = new httplogginginterceptor();         interceptor.setlevel(httplogginginterceptor.level.body);          okhttpclient okclient = new okhttpclient.builder().addinterceptor(interceptor).build();          // retrofit setup           retrofit client = new retrofit2.retrofit.builder()                 .baseurl(base_url)                 .addconverterfactory(gsonconverterfactory.create())                 .client(okclient)                 .build(); 

and here api call body null

 retrofit2.call<generaltokenresponse> generaltokenresponsecall = apiinterface.getgeneralaccesstoken(apigeneral.api_version);         generaltokenresponsecall.enqueue(new retrofit2.callback<generaltokenresponse>() {             @override             public void onresponse(retrofit2.call<generaltokenresponse> call, retrofit2.response<generaltokenresponse> response) {                 log.d("debug", "body: "+response.body());              }              @override             public void onfailure(retrofit2.call<generaltokenresponse> call, throwable t) {              }         }); 

i use so:

    // init okhttp 3 logger     httplogginginterceptor logging = new httplogginginterceptor(new httplogginginterceptor.logger() {         @override public void log(string message) {             log.d("mytag", "okhttp: " + message);         }     });     logging.setlevel(httplogginginterceptor.level.body); 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -