OkHttp Interceptors in Android

May 25 2021 · Kotlin 1.4, Android 5, Android Studio 4.1

Part 1: Implementing OkHttp Interceptors

04. Implement a Custom Logger & Redact Headers

Episode complete

Play next episode

About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 03. Setup HttpLoggingInterceptor & Debug API Calls Next episode: 05. Implement an Authorization Interceptor

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

HttpLoggingInterceptor, by default, uses the Android logging utility to log all network data. But you can easily modify this behavior. Open the app module build.gradle. Here you can find the dependency for the Timber library.

val loggingInterceptor = HttpLoggingInterceptor(object : HttpLoggingInterceptor.Logger {
    override fun log(message: String) {
val loggingInterceptor = HttpLoggingInterceptor { message -> Timber.tag("OkHttp").d(message) }