Skip to content

Commit

Permalink
Merge pull request #11 from kusitms-28th-Meetup-E/fix/log
Browse files Browse the repository at this point in the history
fix:error log 추가
  • Loading branch information
eojinny authored Nov 11, 2023
2 parents 9e2c771 + 99e5a30 commit cdacb9d
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/main/java/gwangjang/server/global/filter/GlobalFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,20 @@ public GatewayFilter apply(Config config) {
log.info("Global Filter Start: request path -> {}" , request.getPath());
}

// Global Post Filter
//Mono는 webflux에서 단일값 전송할때 Mono값으로 전송
return chain.filter(exchange).then(Mono.fromRunnable(()->{
// 예제: /token/** 경로에 대한 요청일 때만 실행
if (request.getPath().toString().startsWith("/token/")) {
log.info("Global com.example.scg.filter baseMessgae: {}", config.getBaseMessage());
// Your global filter logic here

if (config.isPostLogger()){
//Mono는 webflux에서 단일값 전송할때 Mono값으로 전송
return chain.filter(exchange).then(Mono.fromRunnable(() -> {
log.info("Global Filter End: response status code -> {}" , response.getStatusCode());
}
}));
}));
} else {
// /token/** 경로가 아니면 그냥 다음 필터로 이동
return chain.filter(exchange);
}


};
}
Expand Down

0 comments on commit cdacb9d

Please sign in to comment.