Skip to content

Commit 115a385

Browse files
committed
[CHORE] 로그 추가
1 parent ef2d3d6 commit 115a385

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/main/java/com/example/ai_tutor/domain/auth/application/CustomUserDetailsService.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
import com.example.ai_tutor.global.config.security.token.UserPrincipal;
77
import jakarta.transaction.Transactional;
88
import lombok.RequiredArgsConstructor;
9+
import lombok.extern.slf4j.Slf4j;
910
import org.springframework.security.core.userdetails.UserDetails;
1011
import org.springframework.security.core.userdetails.UserDetailsService;
1112
import org.springframework.security.core.userdetails.UsernameNotFoundException;
1213
import org.springframework.stereotype.Service;
1314

1415
import java.util.Optional;
1516

17+
@Slf4j
1618
@RequiredArgsConstructor
1719
@Service
1820
public class CustomUserDetailsService implements UserDetailsService {
@@ -21,21 +23,21 @@ public class CustomUserDetailsService implements UserDetailsService {
2123

2224
@Override
2325
public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException {
24-
26+
log.debug("Trying to load user by email: {}", email);
2527
User user = userRepository.findByEmail(email)
26-
.orElseThrow(() ->
27-
new UsernameNotFoundException("유저 정보를 찾을 수 없습니다.")
28-
);
28+
.orElseThrow(() -> new UsernameNotFoundException("유저 정보를 찾을 수 없습니다."));
2929

30+
log.debug("User found: {}", user);
3031
return UserPrincipal.create(user);
3132
}
3233

3334
@Transactional
3435
public UserDetails loadUserById(Long id) {
36+
log.debug("Trying to load user by ID: {}", id);
3537
Optional<User> user = userRepository.findById(id);
3638
DefaultAssert.isOptionalPresent(user);
3739

40+
log.debug("User found by ID: {}", user);
3841
return UserPrincipal.create(user.get());
3942
}
40-
41-
}
43+
}

0 commit comments

Comments
 (0)