本文整理汇总了Java中com.ihsanbal.logging.Level类的典型用法代码示例。如果您正苦于以下问题:Java Level类的具体用法?Java Level怎么用?Java Level使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Level类属于com.ihsanbal.logging包,在下文中一共展示了Level类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ApiClient
import com.ihsanbal.logging.Level; //导入依赖的package包/类
ApiClient() {
mRetrofitBuilder = new Retrofit.Builder()
.baseUrl("http://op.juhe.cn/")
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create());
mOkHttpClientBuilder = new OkHttpClient.Builder();
mOkHttpClientBuilder.connectTimeout(15, TimeUnit.SECONDS);
if (BuildConfig.DEBUG) {
mOkHttpClientBuilder.addNetworkInterceptor(
new LoggingInterceptor.Builder()
.loggable(BuildConfig.DEBUG)
.setLevel(Level.BODY)
.log(Platform.INFO)
.request("Request")
.response("Response")
.build()
);
}
}
示例2: provideOkHttpClient
import com.ihsanbal.logging.Level; //导入依赖的package包/类
@Provides
@Singleton
public OkHttpClient provideOkHttpClient(Application application, OkHttpClient.Builder builder, @Nullable Cache cache, @Nullable List<Interceptor> interceptors, @Nullable OkHttpConfiguration httpConfiguration) {
builder.cache(cache)
.connectTimeout(CONNECT_TIMEOUT, TimeUnit.SECONDS)
.readTimeout(READ_TIMEOUT, TimeUnit.SECONDS)
.writeTimeout(WRITE_TIMEOUT, TimeUnit.SECONDS)
.addInterceptor(new LoggingInterceptor.Builder()
.loggable(BuildConfig.DEBUG)
.setLevel(Level.BODY)
.request("Request")
.response("Response")
.build());
if (interceptors != null && !interceptors.isEmpty()) {
for (Interceptor interceptor : interceptors) {
builder.addInterceptor(interceptor);
}
}
if (httpConfiguration != null) {
httpConfiguration.configOkHttp(application, builder);
}
return builder.build();
}
示例3: provideOkHttpClient
import com.ihsanbal.logging.Level; //导入依赖的package包/类
@Provides
@Singleton
OkHttpClient provideOkHttpClient() {
OkHttpClient.Builder client = new OkHttpClient.Builder();
client.addInterceptor(new LoggingInterceptor.Builder()
.loggable(BuildConfig.DEBUG)
.setLevel(Level.BASIC)
.log(Platform.INFO)
.tag("LoggingI")
.request("Request")
.response("Response")
.addHeader("version", BuildConfig.VERSION_NAME)
.addQueryParam("query", "0")
// .logger((level, tag, msg) -> Log.w(tag, msg))
.build());
return client.build();
}