Okhttp3Interceptor
Log interceptor of Okhttp3.
// Add Interceptor
val logcat = logFactory("global")
val okhttp = OkHttpClient
.Builder()
.addInterceptor(Okhttp3Interceptor(logcat))
.build()
// Make a request
val request: Request = Request.Builder()
.url("http://127.0.0.1:7777")
.build()
okhttp.newCall(request).execute()
Content copied to clipboard
Since
1.3.3
See also
Properties
Link copied to clipboard
Request body json converter.
Link copied to clipboard
Different levels represent different printing contents.
Link copied to clipboard
The requestLevel function allows you to set the log level it prints based on Request, and returns LogLevel.DEBUG by default.
Link copied to clipboard
The responseLevel function allows you to set the log level it prints based on Request, and returns LogLevel.DEBUG by default.
Link copied to clipboard
Functions
Link copied to clipboard
Convert Request.body to string.
Link copied to clipboard
Deal request log.
Link copied to clipboard
Deal response log.
Link copied to clipboard
Allows you to sanitize sensitive headers to avoid their values appearing in the logs. In the example below, Authorization header value will be replaced with '***' when logging: