How chivorns/okhttploggerinterceptor works
OkHttpLoggerInterceptor is a small Android/Kotlin library that logs HTTP request and response details while an OkHttp request passes through its interceptor chain. Its main runtime path proceeds the request, measures elapsed time, then delegates formatting and output to logging utilities. The utilities inspect response bodies and normalize JSON-like text. The README provides no further capability documentation; the app module appears to be a separate placeholder sample. The graph reflects the shown implementation, not unsampled wiring.
Main entry points: LogUtil.kt Log formatter · OkHttpLoggerInterceptor.kt HTTP interceptor · OkHttpUtil.kt Response helper · StringUtil.kt JSON formatter
Components 6
Interceptor runtime
- HTTP interceptor
okhttp-logger-interceptor/src/main/java/com/chivorn/okhttp/logger/interceptor/OkHttpLoggerInterceptor.kt - Log formatter
okhttp-logger-interceptor/src/main/java/com/chivorn/okhttp/logger/interceptor/utils/LogUtil.kt - Response helper
okhttp-logger-interceptor/src/main/java/com/chivorn/okhttp/logger/interceptor/utils/OkHttpUtil.kt - JSON formatter
okhttp-logger-interceptor/src/main/java/com/chivorn/okhttp/logger/interceptor/utils/StringUtil.kt
Other components
- OkHttp chain
- Timber logging
Connections 6
- HTTP interceptor → OkHttp chain: proceeds request
okhttp-logger-interceptor/src/main/java/com/chivorn/okhttp/logger/interceptor/OkHttpLoggerInterceptor.kt - HTTP interceptor → Log formatter: writes log
okhttp-logger-interceptor/src/main/java/com/chivorn/okhttp/logger/interceptor/OkHttpLoggerInterceptor.kt - Log formatter → Response helper: reads response
okhttp-logger-interceptor/src/main/java/com/chivorn/okhttp/logger/interceptor/utils/LogUtil.kt - Log formatter → JSON formatter: formats bodies
okhttp-logger-interceptor/src/main/java/com/chivorn/okhttp/logger/interceptor/utils/LogUtil.kt - Log formatter → Timber logging: emits logs
okhttp-logger-interceptor/src/main/java/com/chivorn/okhttp/logger/interceptor/utils/LogUtil.kt - Response helper → Timber logging: logs errors
okhttp-logger-interceptor/src/main/java/com/chivorn/okhttp/logger/interceptor/utils/OkHttpUtil.kt