-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build type에 따른 httpinterceptor Logging #93
Conversation
val httpLoggingInterceptor = HttpLoggingInterceptor().apply { | ||
level = if (BuildConfig.DEBUG) HttpLoggingInterceptor.Level.BODY else HttpLoggingInterceptor.Level.NONE | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Timber 를 적용했던 이유가 httplogging 할 때, debug 일때만 Log 찍히게 하기 위해서 적용했었는데, 지금 처럼 따로 if 문으로 적용해줄거면 Timber 를 사용하는 이유가 없어지는 것 같습니당! https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor 처럼 timber 로 log를 찍게 해야할 것 같습니다 ~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
반영했습니다~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생했어~
코멘트 해결하고 머지하면 될 거 같아
@Module | ||
@InstallIn(SingletonComponent::class) | ||
object NetworkModule { | ||
|
||
@Singleton | ||
@Provides | ||
fun provideOkHttpClient(): OkHttpClient { | ||
val httpLoggingInterceptor = HttpLoggingInterceptor() | ||
val logger = HttpLoggingInterceptor.Logger { message -> Timber.tag("okHttp").d(message) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String.format(
getString(R.string.timber_log_format),
super.createStackElementTag(element),
element.lineNumber,
)
tag("okHttp") 메서드 호출하는 부분과 위 코드 블럭 중 하나는 무시될 거 같아
android/core/data/build.gradle.kts
Outdated
@@ -35,4 +40,6 @@ dependencies { | |||
implementation(libs.okhttp.logging.interceptor) | |||
implementation(libs.kotlinx.serialization.json) | |||
implementation(libs.kotlinx.serialization.converter) | |||
implementation(libs.timber) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아까 PR에 feature plugin 에 timber 넣은것 같은데 android library plugin 에 timber 넣고 기존 feature plugin 에 timber 지우면 이 디펜던시는 없어도 될것같아ㅏ@@@
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
반영했습니다~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GOOOD!
Issue
Overview
#76 (comment)
실험 해본 결과
timber_log_format
도 약간 수정했습니다 ('/' 가 있으면 좀 다르게 출력되어 뺐습니다.)