Closed eMZet-zz closed 2 years ago
This issue has been automatically marked as stale because it has not had recent activity.
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
Hey I would like to try to solve this one
Is this really still open?
Looking at ktor-client/ktor-client-plugins/ktor-client-logging/common/src/io/ktor/client/plugins/logging/Logging.kt
it looks like this is there already:
/**
* [Logging] plugin configuration
*/
@KtorDsl
public class Config {
/**
* filters
*/
internal var filters = mutableListOf<(HttpRequestBuilder) -> Boolean>()
/**
* [Logger] instance to use
*/
public var logger: Logger = Logger.DEFAULT
/**
* log [LogLevel]
*/
public var level: LogLevel = LogLevel.HEADERS
/**
* Log messages for calls matching a [predicate].
*/
public fun filter(predicate: (HttpRequestBuilder) -> Boolean) {
filters.add(predicate)
}
}
Subsystem Kotlin multiplatform library: ktor-client-logging:1.3.0
Is your feature request related to a problem? Please describe. Problem: not able to filter calls to be logged. All calls are being logged by default.
Describe the solution you'd like Add a filter option in Logging configuration block (this solution is available on Android in CallLogging feature, but it is absent in kotlin multiplatform) https://ktor.io/servers/features/call-logging.html
Motivation to include to ktor Logging all queries is helpful in debug mode. However, for a production version in which, for example, logs are saved to a file, saving only failed requests would be sufficient. It would be convenient to use the function that is already in the library.