Skip to content

Commit

Permalink
refactor: Replace println with Slf4j for logging (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyojeongchoi committed Sep 26, 2023
1 parent df87224 commit 0d0b567
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions dev/choihyojeong/ext-search-batch/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ dependencies {
annotationProcessor 'org.projectlombok:lombok'
runtimeOnly 'com.mysql:mysql-connector-j'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
}

tasks.named('test') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;


@Slf4j
@SpringBootTest
class NaverNewsBatchTest {



@Autowired
NaverNewsRepository NaverNewsRepoTest;
@Autowired
Expand Down Expand Up @@ -72,14 +72,14 @@ public void getBatchNewsNumber() throws Exception {
// 2. 불러온 10개 중에 업데이트 된 시간이 현재시간인지
for(int i=0; i<10; i++){
if(latestDate.get(i).equals(currentDate) || latestDate.get(i).equals(currentDate.plusSeconds(1)) || latestDate.get(i).equals(currentDate.minusSeconds(1))){
System.out.println("새로 적재된 뉴스입니다 : " +latestTitle.get(i));
log.info("새로 적재된 뉴스입니다 : " +latestTitle.get(i));
saveNewsLen = saveNewsLen +1;
}
else{
System.out.println("새로 적재된 뉴스가 아닙니다 : "+latestTitle.get(i));
log.info("새로 적재된 뉴스가 아닙니다 : "+latestTitle.get(i));
}
}
System.out.println("적재된 뉴스 개수"+ saveNewsLen);
log.info("적재된 뉴스 개수"+ saveNewsLen);

//then
// 3. 그 개수가 0에서 10사이인지
Expand Down Expand Up @@ -111,7 +111,7 @@ public void checkKeyword() throws Exception {
}
}
else {
System.out.println("적재된 뉴스 데이터가 없습니다");
log.info("적재된 뉴스 데이터가 없습니다");
}
}

Expand Down

0 comments on commit 0d0b567

Please sign in to comment.