Skip to content

Commit

Permalink
Feat: WebClientConfiguration 로깅 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
earlgrey02 committed Nov 1, 2023
1 parent eab7a11 commit 91e6b1a
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.quizit.user.global.config

import com.github.jwt.authentication.DefaultJwtAuthentication
import com.quizit.user.global.util.getLogger
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.http.HttpHeaders
Expand All @@ -10,6 +11,8 @@ import org.springframework.web.reactive.function.client.WebClient

@Configuration
class WebClientConfiguration {
private val logger = getLogger()

@Bean
fun webClient(): WebClient =
WebClient.builder()
Expand All @@ -22,7 +25,11 @@ class WebClientConfiguration {
.build()
}
.defaultIfEmpty(request)
.flatMap { next.exchange(it) }
.flatMap {
logger.info { "HTTP ${request.method()} ${request.url().path}" }
next.exchange(it)
.doOnNext { logger.info { "HTTP ${it.statusCode()}" } }
}
}
.build()
}

0 comments on commit 91e6b1a

Please sign in to comment.