more logging

This commit is contained in:
LionTion committed 2026-10-22 20:27:30 +02:00
1 parent 210fdde27e
commit e42b313640
2 files changed
+5 -3

No files matched your search

@@ -51,16 +51,18 @@ public class CodeController {
t.setActivationTimestamp(now); t.setActivationTimestamp(now);
tourCodeService.updateCode(t); tourCodeService.updateCode(t);
} else if (activationTimestamp.plus(12, ChronoUnit.HOURS).isBefore(now)) { } else if (activationTimestamp.plus(12, ChronoUnit.HOURS).isBefore(now)) {
logger.warning("Tour " + t.getCode() + " expired");
return ResponseEntity.notFound().build(); return ResponseEntity.notFound().build();
} }
LocalDateTime heartbeat = t.getLastHeartbeatTimestamp(); LocalDateTime heartbeat = t.getLastHeartbeatTimestamp();
if (heartbeat != null && heartbeat.plus(3, ChronoUnit.MINUTES).isAfter(now)) { if (heartbeat != null && heartbeat.plus(3, ChronoUnit.MINUTES).isAfter(now)) {
logger.warning("Tour " + t.getCode() + " was tried to be accessed.");
return ResponseEntity.notFound().build(); return ResponseEntity.notFound().build();
} }
t.setLastHeartbeatTimestamp(now); t.setLastHeartbeatTimestamp(now);
tourCodeService.updateCode(t); tourCodeService.updateCode(t);
TourSession tourSession = tourSessionService.getSessionByTourCode(t); TourSession tourSession = tourSessionService.getSessionByTourCode(t);
logger.info("Tour: " + t.getCode() + " started playing with Session " + tourSession); logger.info("Tour " + t.getCode() + " started playing with Session " + tourSession);
return ResponseEntity.ok( return ResponseEntity.ok(
GetSessionAndAllRiddleData.builder() GetSessionAndAllRiddleData.builder()
.riddles(riddleService.getAllRiddles().stream() .riddles(riddleService.getAllRiddles().stream()
@@ -93,7 +95,7 @@ public class CodeController {
} }
if (t == null) { if (t == null) {
t = tourCodeService.addTourCode(code); t = tourCodeService.addTourCode(code);
System.out.println("DEBUG: Created TC " + t.getId()); logger.info("Created TC " + t.getId());
return ResponseEntity.ok(t.getCode()); return ResponseEntity.ok(t.getCode());
} }
return ResponseEntity.badRequest().body("BAD: " + t.getId()); return ResponseEntity.badRequest().body("BAD: " + t.getId());
@@ -32,7 +32,7 @@ public class SessionController {
} }
TourSession session = tourSessionService.getSessionByTourCode(code); TourSession session = tourSessionService.getSessionByTourCode(code);
if (session == null || !session.getTourCode().getActivated()) { if (session == null || !session.getTourCode().getActivated()) {
System.out.println("Session not found for " + code); logger.info("Session not found for " + code);
return "Not available"; return "Not available";
} }
return String.format("%s", session.getData()); return String.format("%s", session.getData());