Skip to content

//logging-interceptor/okhttp3.logging/HttpLoggingInterceptor

HttpLoggingInterceptor

[jvm]\ class HttpLoggingInterceptor@JvmOverloadsconstructor(logger: HttpLoggingInterceptor.Logger = Logger.DEFAULT) : Interceptor

An OkHttp interceptor which logs request and response information. Can be applied as an application interceptor or as a OkHttpClient.networkInterceptors.

The format of the logs created by this class should not be considered stable and may change slightly between releases. If you need a stable logging format, use your own interceptor.

Constructors

HttpLoggingInterceptor [jvm]
@JvmOverloads
fun HttpLoggingInterceptor(logger: HttpLoggingInterceptor.Logger = Logger.DEFAULT)

Types

Name Summary
Level [jvm]
enum Level : Enum<HttpLoggingInterceptor.Level>
Logger [jvm]
fun interface Logger

Functions

Name Summary
intercept [jvm]
open override fun intercept(chain: Interceptor.Chain): Response
redactHeader [jvm]
fun redactHeader(name: String)
setLevel [jvm]
fun setLevel(level: HttpLoggingInterceptor.Level): HttpLoggingInterceptor
Sets the level and returns this.

Properties

Name Summary
level [jvm]
@Volatile
@set:JvmName(name = "level")
var level: HttpLoggingInterceptor.Level