
Logs, inspects, and persists HTTP network traffic in client applications. Features automatic logging, persistence via Room, ProtoBuf support, and a customizable Compose UI for detailed inspection.
KtorSniffer is a Kotlin Multiplatform library for logging, inspecting, and persisting HTTP network traffic in Ktor client applications. It is designed to help developers debug, analyze, and visualize network requests and responses across Android, iOS.
Note: Instructions below assume you have a Kotlin Multiplatform project with Ktor client and Compose Multiplatform set up.
Add the dependency to your shared module:
implementation("io.github.frankieshao:ktorsniffer:0.1.1")val client = HttpClient {
install(Sniffer)
// ... your other plugins
}In your Application or main Activity:
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
KtorSniffer.init(this)
}
}Note: You must call
KtorSniffer.init(context)before using the log UI or DAO on Android.
You can embed the provided Compose UI to browse and inspect logs:
@Composable
fun MyApp() {
KtorSnifferScreen(onBack = { /* handle back navigation */ })
}Sniffer plugin hooks into Ktor's client pipeline, capturing request and response data at multiple stages.You can customize logging behavior via the SnifferConfig DSL:
install(Sniffer) {
protoBuf { /* configure ProtoBuf formatting */ }
coroutineScope { /* provide custom CoroutineScope if needed */ }
}See the composeApp module for a full sample app demonstrating GET/POST/ProtoBuf requests and the log UI.
Contributions, issues, and feature requests are welcome!
Feel free to open an issue or submit a pull request.
Enjoy debugging with KtorSniffer!
If you like this project, please star it on GitHub and share your feedback.
KtorSniffer is a Kotlin Multiplatform library for logging, inspecting, and persisting HTTP network traffic in Ktor client applications. It is designed to help developers debug, analyze, and visualize network requests and responses across Android, iOS.
Note: Instructions below assume you have a Kotlin Multiplatform project with Ktor client and Compose Multiplatform set up.
Add the dependency to your shared module:
implementation("io.github.frankieshao:ktorsniffer:0.1.1")val client = HttpClient {
install(Sniffer)
// ... your other plugins
}In your Application or main Activity:
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
KtorSniffer.init(this)
}
}Note: You must call
KtorSniffer.init(context)before using the log UI or DAO on Android.
You can embed the provided Compose UI to browse and inspect logs:
@Composable
fun MyApp() {
KtorSnifferScreen(onBack = { /* handle back navigation */ })
}Sniffer plugin hooks into Ktor's client pipeline, capturing request and response data at multiple stages.You can customize logging behavior via the SnifferConfig DSL:
install(Sniffer) {
protoBuf { /* configure ProtoBuf formatting */ }
coroutineScope { /* provide custom CoroutineScope if needed */ }
}See the composeApp module for a full sample app demonstrating GET/POST/ProtoBuf requests and the log UI.
Contributions, issues, and feature requests are welcome!
Feel free to open an issue or submit a pull request.
Enjoy debugging with KtorSniffer!
If you like this project, please star it on GitHub and share your feedback.