Skip to content

Commit 2248472

Browse files
committed
[chore] 외부 API조회 시 로깅 추가
1 parent 341a192 commit 2248472

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

bada-on-config

src/main/java/nambang_swag/bada_on/config/FireBaseConfig.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
package nambang_swag.bada_on.config;
22

3-
import java.io.ByteArrayInputStream;
4-
import java.io.File;
53
import java.io.FileInputStream;
64
import java.io.IOException;
7-
import java.io.InputStream;
8-
import java.nio.charset.StandardCharsets;
95

106
import org.springframework.context.annotation.Bean;
117
import org.springframework.context.annotation.Configuration;

src/main/java/nambang_swag/bada_on/service/ExternalApiService.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,36 +67,43 @@ public class ExternalApiService {
6767
// 초단기 예보 가져오기 - 매 시간 30분에 발표, 45분에 api반영
6868
@Transactional
6969
public void getUltraShortTermForecast() {
70+
log.info("초단기 예보 정보 수집 시작");
7071
List<Place> places = placeRepository.findAll();
7172
for (Place place : places) {
7273
WeatherForeCastApiResponse response = callUltraShortTermForecastApi(place);
7374
processWeatherForecastData(response, place);
7475
}
76+
log.info("초단기 예보 정보 수집 종료");
7577
}
7678

7779
// 단기 예보 가져오기 - 매 시간 10분에 api반영
7880
@Transactional
7981
public void getShortTermForecast() {
82+
log.info("단기 예보 정보 수집 시작");
8083
List<Place> places = placeRepository.findAll();
8184
for (Place place : places) {
8285
WeatherForeCastApiResponse response = callShortTermForecastApi(place);
8386
processWeatherForecastData(response, place);
8487
}
88+
log.info("단기 예보 정보 수집 종료");
8589
}
8690

8791
// 초단기 실황 가져오기
8892
@Transactional
8993
public void getUltraShortTermNowCast() {
94+
log.info("초단기 실황 정보 수집 시작");
9095
List<Place> places = placeRepository.findAll();
9196
for (Place place : places) {
9297
WeatherNowCastApiResponse response = callUltraShortTermNowCastApi(place);
9398
processWeatherNowCastData(response, place);
9499
}
100+
log.info("초단기 실황 정보 수집 종료");
95101
}
96102

97103
// 조석예보 가져오기
98104
@Transactional
99105
public void getTidalForecast() {
106+
log.info("조석예보 정보 수집 시작");
100107
LocalDateTime now = LocalDateTime.now();
101108
for (int i = 0; i < 3; i++) {
102109
LocalDateTime time = now.plusDays(i);
@@ -109,28 +116,33 @@ public void getTidalForecast() {
109116
}
110117
}
111118
}
119+
log.info("조석예보 정보 수집 종료");
112120
}
113121

114122
// 일출일몰 예보 가져오기
115123
@Transactional
116124
public void getSunRiseSetData() {
125+
log.info("일출 일몰 정보 수집 시작");
117126
List<Place> places = placeRepository.findAll();
118127
LocalDateTime now = LocalDateTime.now();
119128
String baseDate = now.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
120129
for (Place place : places) {
121130
SunRiseSetForeCastApiResponse response = callSunRiseSetForecastApi(place, baseDate);
122131
processSunRiseSetData(response, place, baseDate);
123132
}
133+
log.info("일출 일몰 정보 수집 종료");
124134
}
125135

126136
// 수온 정보 가져오기
127137
@Transactional
128138
public void getOceanTemperature() {
139+
log.info("수온 정보 수집 시작");
129140
List<Place> places = placeRepository.findAll();
130141
for (Place place : places) {
131142
WaterTemperatureForecastApiResponse response = callWaterTemperatureForecastApi(place);
132143
processWaterTemperatureData(response, place);
133144
}
145+
log.info("수온 정보 수집 종료");
134146
}
135147

136148
@Scheduled(cron = "0 11 * * * *")

0 commit comments

Comments
 (0)