chore: ktor 过滤日志

This commit is contained in:
lisonge 2023-12-25 23:51:53 +08:00
parent f3261d524c
commit e5b71326fd

View File

@ -6,13 +6,15 @@ import io.ktor.http.HttpStatusCode
import io.ktor.server.application.createApplicationPlugin
import io.ktor.server.application.hooks.CallFailed
import io.ktor.server.request.uri
import io.ktor.server.response.header
import io.ktor.server.response.respond
import li.songe.gkd.data.RpcError
val KtorErrorPlugin = createApplicationPlugin(name = "KtorErrorPlugin") {
onCall { call ->
Log.d("Ktor", "onCall: ${call.request.uri}")
// TODO 在局域网会被扫描工具批量请求多个路径
if (call.request.uri == "/" || call.request.uri.startsWith("/api/")) {
Log.d("Ktor", "onCall: ${call.request.uri}")
}
}
on(CallFailed) { call, cause ->
when (cause) {