Skip to content

Commit

Permalink
feat: request 임시로깅
Browse files Browse the repository at this point in the history
  • Loading branch information
jimin3263 committed Aug 25, 2024
1 parent 1c4ea66 commit 78ab5bb
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.pokit.auth.interceptor

import io.github.oshai.kotlinlogging.KotlinLogging
import jakarta.servlet.http.HttpServletRequest
import jakarta.servlet.http.HttpServletResponse
import org.springframework.stereotype.Component
import org.springframework.web.servlet.HandlerInterceptor


@Component
class RequestLoggingInterceptor : HandlerInterceptor {
private val logger = KotlinLogging.logger { }

override fun preHandle(
request: HttpServletRequest,
response: HttpServletResponse,
handler: Any
): Boolean {
val uri = request.requestURI
logger.debug { "[Requested URI] $uri" }
return true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.pokit.auth.interceptor

import org.springframework.context.annotation.Configuration
import org.springframework.web.servlet.config.annotation.InterceptorRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer

@Configuration
class WebConfig(
private val requestLoggingInterceptor: RequestLoggingInterceptor
) : WebMvcConfigurer {
override fun addInterceptors(registry: InterceptorRegistry) {
registry.addInterceptor(requestLoggingInterceptor)
}
}

0 comments on commit 78ab5bb

Please sign in to comment.