网络接口log打印

private static void initOkHttpClient() {

if (okHttpClient == null) {
synchronized (RetrofitHelper1.class) {
if (okHttpClient == null) {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
okHttpClient = new OkHttpClient.Builder()
.addInterceptor(interceptor)
.build();
}
}
}

}





注意要添加OKLog的依赖!

猜你喜欢

转载自www.cnblogs.com/ysxy/p/8982157.html
今日推荐