mirror of
https://github.com/gkd-kit/gkd.git
synced 2024-11-16 11:42:22 +08:00
chore: ktor 过滤日志
This commit is contained in:
parent
f3261d524c
commit
e5b71326fd
|
@ -6,14 +6,16 @@ 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 ->
|
||||
// TODO 在局域网会被扫描工具批量请求多个路径
|
||||
if (call.request.uri == "/" || call.request.uri.startsWith("/api/")) {
|
||||
Log.d("Ktor", "onCall: ${call.request.uri}")
|
||||
}
|
||||
}
|
||||
on(CallFailed) { call, cause ->
|
||||
when (cause) {
|
||||
is RpcError -> {
|
||||
|
|
Loading…
Reference in New Issue
Block a user