Skip to content
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

#186 / 릴리즈 모드에서 Logging Interceptor body 감추기 #187

Merged
merged 2 commits into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions app/src/main/java/sopt/uni/UniApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,31 @@ import timber.log.Timber
class UniApplication : Application() {
override fun onCreate() {
super.onCreate()
initializeSparkleStorage()
initializeKakaoSdk()
initializeDebugTree()
setDefaultNightMode()
clearSharedPreferences()
}

private fun initializeSparkleStorage() {
SparkleStorage.init(this)
SparkleStorage.timerClear()
}

private fun initializeKakaoSdk() {
KakaoSdk.init(this, BuildConfig.KAKAO_APP_KEY)
}

private fun initializeDebugTree() {
if (BuildConfig.DEBUG) Timber.plant(Timber.DebugTree())
}

private fun setDefaultNightMode() {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
}

private fun clearSharedPreferences() {
val sharedPreferences =
applicationContext.getSharedPreferences("timer_prefs", Context.MODE_PRIVATE)
val editor = sharedPreferences.edit()
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/sopt/uni/di/RetrofitModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import sopt.uni.BuildConfig
import sopt.uni.BuildConfig.BASE_URL
import sopt.uni.data.datasource.remote.AuthInterceptor
import sopt.uni.data.service.MyPageService
Expand Down Expand Up @@ -45,7 +46,8 @@ object RetrofitModule {
@Singleton
@Logger
fun provideHttpLoggingInterceptor(): Interceptor = HttpLoggingInterceptor().apply {
level = HttpLoggingInterceptor.Level.BODY
level =
if (BuildConfig.DEBUG) HttpLoggingInterceptor.Level.BODY else HttpLoggingInterceptor.Level.NONE
}

@Provides
Expand Down
Loading