|
@@ -38,28 +38,28 @@ import static com.mgtech.base_library.consts.SharePreConst.LANGUAGE;
|
|
|
public class InterceptorUtil {
|
|
public class InterceptorUtil {
|
|
|
public static String TAG="tua_interceptor";
|
|
public static String TAG="tua_interceptor";
|
|
|
|
|
|
|
|
-// //日志拦截器
|
|
|
|
|
-// public static HttpLoggingInterceptor LogInterceptor(){
|
|
|
|
|
-// return new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() {
|
|
|
|
|
-// @Override
|
|
|
|
|
-// public void log(String message) {
|
|
|
|
|
-// Log.w(TAG, "log: "+message );
|
|
|
|
|
-// }
|
|
|
|
|
-// }).setLevel((TextUtils.equals("dalian", BuildConfig.BUILD_TYPE) || TextUtils.equals("debug", BuildConfig.BUILD_TYPE)) ? HttpLoggingInterceptor.Level.BODY
|
|
|
|
|
-// : HttpLoggingInterceptor.Level.NONE);//设置打印数据的级别
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ //日志拦截器
|
|
|
public static HttpLoggingInterceptor LogInterceptor(){
|
|
public static HttpLoggingInterceptor LogInterceptor(){
|
|
|
return new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() {
|
|
return new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() {
|
|
|
@Override
|
|
@Override
|
|
|
public void log(String message) {
|
|
public void log(String message) {
|
|
|
Log.w(TAG, "log: "+message );
|
|
Log.w(TAG, "log: "+message );
|
|
|
}
|
|
}
|
|
|
- }).setLevel(HttpLoggingInterceptor.Level.BODY);//设置打印数据的级别
|
|
|
|
|
|
|
+ }).setLevel((TextUtils.equals("dalian", BuildConfig.BUILD_TYPE) || TextUtils.equals("debug", BuildConfig.BUILD_TYPE)) ? HttpLoggingInterceptor.Level.BODY
|
|
|
|
|
+ : HttpLoggingInterceptor.Level.NONE);//设置打印数据的级别
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+// public static HttpLoggingInterceptor LogInterceptor(){
|
|
|
|
|
+// return new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() {
|
|
|
|
|
+// @Override
|
|
|
|
|
+// public void log(String message) {
|
|
|
|
|
+// Log.w(TAG, "log: "+message );
|
|
|
|
|
+// }
|
|
|
|
|
+// }).setLevel(HttpLoggingInterceptor.Level.BODY);//设置打印数据的级别
|
|
|
|
|
+// }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
//无网络的情况下读取缓存
|
|
//无网络的情况下读取缓存
|
|
|
public static Interceptor cacheInterceptor(){
|
|
public static Interceptor cacheInterceptor(){
|
|
|
return new Interceptor() {
|
|
return new Interceptor() {
|