Skip to content

Commit

Permalink
fixing logs
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanSST committed Aug 1, 2023
1 parent 7733978 commit 58d5727
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/main/java/ch/stephan/chickenfarm/scale/ScaleService.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public int measureWeight(String uid) {
try {
BrickletLoadCellV2 loadCell = new BrickletLoadCellV2(uid, ipConnection);
weight = loadCell.getWeight();
log.info("Weight: " + weight + " g");
log.info("Scale {} has weight {}g.", uid, weight);

} catch (TinkerforgeException ex) {
ex.printStackTrace();
Expand All @@ -51,7 +51,7 @@ public String calibrate(String uid) {
int before = loadCell.getWeight();
loadCell.calibrate(before);
int after = loadCell.getWeight();
log.info("Scale was recalibrated. Before: " + before + " g - after: " + after + " g");
log.info("Scale {} was recalibrated. Before: {}g - after: {}g.", uid, before, after);

} catch (TinkerforgeException ex) {
ex.printStackTrace();
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/ch/stephan/chickenfarm/timer/ScaleObserver.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.slf4j.LoggerFactory;
import org.slf4j.helpers.MessageFormatter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import ch.stephan.chickenfarm.messenger.MessengerService;
Expand All @@ -26,7 +25,7 @@ public class ScaleObserver {
@Autowired
private MessengerService whatsappService;

@Scheduled(fixedRate = 10000)
// @Scheduled(fixedRate = 10000)
public void measureWeights() {
String uid = "23yp";
int weight = scaleService.measureWeight(uid);
Expand All @@ -44,7 +43,7 @@ public void measureWeights() {
whatsappService.sendNotification(message);

} else { // nothing special
log.info("Box {} with weight {}g at {}", weight, dateFormat.format(new Date()));
log.info("Box {} with weight {}g at {}", uid, weight, dateFormat.format(new Date()));
}

}
Expand Down

0 comments on commit 58d5727

Please sign in to comment.