Adding debug-log
This commit is contained in:
@ -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());
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
logging.level.root=DEBUG
|
||||
# ? Telegram Bot
|
||||
telegram.bot.token=${TELEGRAM_BOT_TOKEN}
|
||||
telegram.chat.id=${TELEGRAM_CHAT_ID:7321440614}
|
||||
|
||||
Reference in New Issue
Block a user