IT/Android
안드로이드 스튜디오/ Retrofit/OkHttpClient 로그 찍는 방법
은정21
2022. 3. 23. 18:50
반응형
Retrofit에서 모든 통신을 로그찍어서 보고 싶다면 addInterceptor를 해주면 된다.
//설명추가 예정
val httpLoggingInterceptor = HttpLoggingInterceptor()
httpLoggingInterceptor.apply{
httpLoggingInterceptor.level = HttpLoggingInterceptor.Level.BODY
}
OkHttpClient.Builder()
.addInterceptor(httpLoggingInterceptor)
.build()