This commit is contained in:
2024-08-27 21:34:18 +02:00
parent cab12fca92
commit c11eaaee45
13 changed files with 118 additions and 373 deletions
@@ -102,4 +102,27 @@ Message: ${cause.message}
SWException.log(msg, cause.stackTraceToString())
call.response.headers.append("X-Caught", "1")
}
onCallRespond { call ->
if (call.response.status()?.isSuccess() == true) {
return@onCallRespond
}
val msg = """
URI: ${call.request.uri}
Method: ${call.request.httpMethod.value}
Response: ${call.response.status()?.value}
IP: ${call.request.headers["X-Forwarded-For"] ?: call.request.local.remoteHost}
UserAgent: ${call.request.headers["User-Agent"]}
""".trimIndent()
val stack = """
Headers:
${call.request.headers.entries().joinToString("\n ") { "${it.key}: ${it.value}" }}
Body:
${call.request.receiveChannel()}
""".trimIndent()
SWException.log(msg, stack)
}
}