mirror of
https://github.com/square/okhttp.git
synced 2025-11-27 18:21:14 +03:00
Remove most of the SAM bridges
The ReplaceWith() on these doesn't work well. For interceptors I expect the need to be common enough that I'm making these new APIs that we'll keep going forward. This is for both creating interceptors directly and as arguments to addInterceptor() and addNetworkInterceptor().
This commit is contained in:
@@ -109,14 +109,6 @@ class HttpLoggingInterceptor @JvmOverloads constructor(
|
||||
fun log(message: String)
|
||||
|
||||
companion object {
|
||||
@JvmName("-deprecated_Logger")
|
||||
@Deprecated(
|
||||
message = "No SAM (single-abstract-method) conversions for Kotlin declarations",
|
||||
level = DeprecationLevel.WARNING)
|
||||
operator fun invoke(block: (message: String) -> Unit): Logger = object : Logger {
|
||||
override fun log(message: String) = block(message)
|
||||
}
|
||||
|
||||
/** A [Logger] defaults output appropriate for the current platform. */
|
||||
@JvmField
|
||||
val DEFAULT: Logger = object : Logger {
|
||||
|
||||
@@ -150,8 +150,6 @@ class LoggingEventListener private constructor(
|
||||
open class Factory @JvmOverloads constructor(
|
||||
private val logger: HttpLoggingInterceptor.Logger = HttpLoggingInterceptor.Logger.DEFAULT
|
||||
) : EventListener.Factory {
|
||||
constructor(block: (string: String) -> Unit) : this(HttpLoggingInterceptor.Logger(block))
|
||||
|
||||
override fun create(call: Call): EventListener = LoggingEventListener(logger)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user