Skip to content

Commit f32304c

Browse files
committed
README: Document usage with Ktor
See https://ktor.io/docs/client-logging.html#custom_logger
1 parent f4ac8e9 commit f32304c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.md

+22
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,26 @@ class MyApplication : Application() {
129129
}
130130
```
131131

132+
## Ktor integration
133+
134+
Ktor supports [providing a custom logger][ktor-logging]:
135+
136+
```kotlin
137+
import io.ktor.client.*
138+
import io.ktor.client.engine.cio.*
139+
import io.ktor.client.plugins.logging.*
140+
import saschpe.log4k.Log
141+
142+
val httpClient = HttpClient(CIO) {
143+
install(Logging) {
144+
level = LogLevel.ALL
145+
logger = object : Logger {
146+
override fun log(message: String) = Log.info { message }
147+
}
148+
}
149+
}
150+
```
151+
132152
## Users
133153

134154
- [Alpha+ Player - Unofficial player for Soma FM](https://play.google.com/store/apps/details?id=saschpe.alphaplus)
@@ -150,4 +170,6 @@ class MyApplication : Application() {
150170
See the License for the specific language governing permissions and
151171
limitations under the License.
152172

173+
[ktor-logging]: https://ktor.io/docs/client-logging.html#custom_logger
174+
153175
[maven-central]: https://search.maven.org/artifact/de.peilicke.sascha/android-customtabs

0 commit comments

Comments
 (0)