Skip to content

Commit

Permalink
Fix IP log
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziedelth committed May 22, 2024
1 parent 4e1d04a commit e053f7f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/kotlin/fr/shikkanime/modules/Routing.kt
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private fun logCallDetails(call: ApplicationCall) {
val status = call.response.status()?.value ?: 0
val duration = ZonedDateTime.now().toInstant().toEpochMilli() - startTime.toInstant().toEpochMilli()
val path = call.request.path()
val ipAddress = call.request.origin.remoteHost
val ipAddress = call.request.header("X-Forwarded-For") ?: call.request.origin.remoteHost
val userAgent = call.request.userAgent() ?: "Unknown"

logger.info("[$ipAddress - $userAgent] ($status - $duration ms) $httpMethod ${call.request.origin.uri} -> $path")
Expand Down

0 comments on commit e053f7f

Please sign in to comment.