File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
src/main/java/org/tuna/zoopzoop/backend/global/config/sentry Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 1+ package org .tuna .zoopzoop .backend .global .config .sentry ;
2+
3+ import org .springframework .core .env .Environment ;
4+ import org .springframework .stereotype .Component ;
5+
6+ @ Component
7+ public class ProfileChecker {
8+ private final Environment environment ;
9+
10+ public ProfileChecker (Environment environment ) {
11+ this .environment = environment ;
12+ }
13+
14+ public String [] getActiveProfiles () {
15+ return environment .getActiveProfiles ();
16+ }
17+ }
Original file line number Diff line number Diff line change 11package org .tuna .zoopzoop .backend .global .config .sentry ;
22
33import io .sentry .SentryOptions ;
4+ import lombok .RequiredArgsConstructor ;
5+ import lombok .extern .slf4j .Slf4j ;
46import org .springframework .context .annotation .Bean ;
57import org .springframework .context .annotation .Configuration ;
68
79@ Configuration
10+ @ RequiredArgsConstructor
11+ @ Slf4j
812public class SentryConfig {
13+ private final ProfileChecker profileChecker ;
914
1015 @ Bean
1116 public SentryOptions .BeforeSendCallback beforeSend () {
1217 return (event , hint ) -> {
18+ log .info ("[Sentry] 현재 프로필: {}" , profileChecker .getActiveProfiles ()[0 ]);
19+ if ("test" .equals (profileChecker .getActiveProfiles ()[0 ])) return null ;
20+ log .info ("[Sentry] 정상 통과됨." );
1321 if (event .getMessage () != null
1422 && event .getMessage ().getFormatted ().contains ("JWT 토큰" )) {
1523 return null ;
1624 }
1725 return event ;
1826 };
1927 }
20- }
28+ }
You can’t perform that action at this time.
0 commit comments