diff --git a/src/main/java/se/urmo/electricityalert/alert/AlertService.java b/src/main/java/se/urmo/electricityalert/alert/AlertService.java index 6d101a2..99bdde3 100644 --- a/src/main/java/se/urmo/electricityalert/alert/AlertService.java +++ b/src/main/java/se/urmo/electricityalert/alert/AlertService.java @@ -1,5 +1,6 @@ package se.urmo.electricityalert.alert; +import lombok.extern.slf4j.Slf4j; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; @@ -12,10 +13,9 @@ import se.urmo.electricityalert.store.InMemoryPriceStore; import java.math.BigDecimal; import java.time.LocalDateTime; +@Slf4j @Service public class AlertService { - private static final Logger log = LoggerFactory.getLogger(AlertService.class); - private final InMemoryPriceStore store; private final TelegramNotifier notifier; private final BigDecimal threshold; @@ -33,7 +33,7 @@ public class AlertService { public void checkPrices() { LocalDateTime oneHourLater = LocalDateTime.now().withMinute(0).withSecond(0).plusHours(1); ElectricityPrice price = store.get(oneHourLater); - + log.debug("Checking price at {} ({})", oneHourLater, price); if (price != null && price.price().compareTo(threshold) < 0 && !store.alreadyNotified(oneHourLater)) { String msg = String.format("⚡ In the next hour (%s) the price is %.2f SEK/kWh. Plug in the car!", oneHourLater, price.price()); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index a67a404..ae95d37 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,3 +1,4 @@ +logging.level.root=DEBUG # ? Telegram Bot telegram.bot.token=${TELEGRAM_BOT_TOKEN} telegram.chat.id=${TELEGRAM_CHAT_ID:7321440614}