Skip to content

Commit

Permalink
fix: System.out.println() -> log.info() (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
toychip committed Feb 12, 2024
1 parent aba7db0 commit 45c1775
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

import com.api.ttoklip.domain.member.domain.Member;
import java.util.Optional;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.domain.AuditorAware;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;

@Slf4j
@EnableJpaAuditing
@Configuration
public class BaseEntityConfig {
Expand All @@ -21,9 +23,9 @@ public AuditorAware<String> auditorProvider() {
return Optional.of("AnonymousNULL");
}

System.out.println("authentication = " + authentication);
System.out.println("----------- 클래스 타입" + authentication.getClass());
System.out.println("----------- 클래스 타입" + authentication.getPrincipal().getClass());
log.info("authentication = " + authentication);
log.info("----------- 클래스 타입" + authentication.getClass());
log.info("----------- 클래스 타입" + authentication.getPrincipal().getClass());


Object principal = authentication.getPrincipal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
import com.api.ttoklip.global.security.auth.userInfo.OAuth2UserInfo;
import java.util.Optional;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RequiredArgsConstructor
public class AuthService {
Expand Down Expand Up @@ -49,8 +51,8 @@ private LoginResponse getLoginResponse(final Member member, final boolean ifFirs
}

private Member registerNewMember(final OAuth2UserInfo userInfo, final String provider) {
System.out.println("AuthService.registerNewMember");
System.out.println("userInfo.getName() = " + userInfo.getName());
log.info("AuthService.registerNewMember");
log.info("userInfo.getName() = " + userInfo.getName());
Member newMember = Member.builder()
.email(userInfo.getEmail())
.originName(userInfo.getName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private KakaoUserInfo getKakaoUserInfo(String accessToken) {
.bodyToMono(new ParameterizedTypeReference<Map<String, Object>>() {
})
.block();
System.out.println("---------------------------------------- attributes = " + attributes);
log.info("---------------------------------------- attributes = " + attributes);
return new KakaoUserInfo(attributes);
}

Expand All @@ -63,7 +63,7 @@ private OAuth2UserInfo getNaverUserInfo(final String accessToken) {
.bodyToMono(new ParameterizedTypeReference<Map<String, Object>>() {
})
.block();
System.out.println("---------------------------------------- naver attributes = " + attributes);
log.info("---------------------------------------- naver attributes = " + attributes);
return new NaverUserInfo(attributes);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ private void setContextHolder(String jwtToken, Member loginMember) {
List<GrantedAuthority> authorities = getAuthorities(loginMember.getRole());
UsernamePasswordAuthenticationToken authenticationToken =
new UsernamePasswordAuthenticationToken(loginMember, jwtToken, authorities);
System.out.println("------------------JwtProvider.setContextHolder");
log.info("------------------JwtProvider.setContextHolder");

SecurityContextHolder.getContext().setAuthentication(authenticationToken);
System.out.println("loginMember = " + loginMember.getEmail());
System.out.println("------end------------JwtProvider.setContextHolder");
log.info("loginMember = " + loginMember.getEmail());
log.info("------end------------JwtProvider.setContextHolder");
}

private List<GrantedAuthority> getAuthorities(Role role) {
Expand Down

0 comments on commit 45c1775

Please sign in to comment.