Skip to content

Commit

Permalink
add log
Browse files Browse the repository at this point in the history
  • Loading branch information
Liloupar committed Dec 30, 2019
1 parent aa98baf commit 888c9e5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ dependencies {
implementation 'cn.wanghaomiao:JsoupXpath:2.3.2'
implementation 'com.jayway.jsonpath:json-path:2.4.0'
implementation 'com.julienviet:retrofit-vertx:1.1.3'
implementation("com.squareup.okhttp3:logging-interceptor:4.2.1")

}
compileKotlin {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/lightink/reader/service/YueduSchedule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class YueduSchedule {
Shuyuan.shuyuanlist = map
logger.info("shuyuan: {}", map)
}

}

companion object Shuyuan {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package io.legado.app.help.http

import com.julienviet.retrofit.vertx.VertxCallFactory
import io.vertx.core.http.HttpClientOptions
import kotlinx.coroutines.suspendCancellableCoroutine
import okhttp3.*
import okhttp3.ConnectionSpec
import okhttp3.logging.HttpLoggingInterceptor
import org.lightink.reader.ReaderApplication
import retrofit2.Retrofit
import java.util.*
import java.util.concurrent.TimeUnit
import kotlin.coroutines.resume


object HttpHelper {

Expand All @@ -25,6 +25,8 @@ object HttpHelper {
val dispatcher = Dispatcher()
dispatcher.maxRequests = 200
dispatcher.maxRequestsPerHost = 200
val logging = HttpLoggingInterceptor()
logging.level = HttpLoggingInterceptor.Level.BODY

val builder = OkHttpClient.Builder()
.connectTimeout(15, TimeUnit.SECONDS)
Expand All @@ -39,6 +41,8 @@ object HttpHelper {
.protocols(listOf(Protocol.HTTP_1_1))
.dispatcher(dispatcher)
.addInterceptor(getHeaderInterceptor())
.addInterceptor(logging)


builder.build()
}
Expand Down

0 comments on commit 888c9e5

Please sign in to comment.