diff options
Diffstat (limited to 'juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java')
-rw-r--r-- | juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java b/juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java index 831d16f1..adb39bb2 100644 --- a/juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java +++ b/juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java @@ -52,7 +52,7 @@ public class WebsocketComponent extends TextWebSocketHandler { visitor = userService.getUserByHash(hash); } else { try { - logger.info(String.format("wrong hash for %d from %s", visitor.getUid(), hXRealIP)); + logger.info("wrong hash for {} from {}", visitor.getUid(), hXRealIP); session.close(new CloseStatus(403, "Forbidden")); } catch (IOException e) { logger.warn("ws error", e); @@ -61,19 +61,19 @@ public class WebsocketComponent extends TextWebSocketHandler { break; } } - logger.info(String.format("user %d connected to %s from %s", visitor.getUid(), hLocation.getPath(), hXRealIP)); + logger.info("user {} connected to {} from {}", visitor.getUid(), hLocation.getPath(), hXRealIP); int MID = 0; SocketSubscribed sockSubscr = null; if (hLocation.getPath().equals("/")) { - logger.info(String.format("user %d connected", visitor.getUid())); + logger.info("user {} connected", visitor.getUid()); sockSubscr = new SocketSubscribed(session, hXRealIP, visitor, false); } else if (hLocation.getPath().equals("/_all")) { - logger.info(String.format("user %d connected to legacy _all (%s)", visitor.getUid(), hLocation.getPath())); + logger.info("user {} connected to legacy _all ({})", visitor.getUid(), hLocation.getPath()); sockSubscr = new SocketSubscribed(session, hXRealIP, visitor, true); sockSubscr.allMessages = true; } else if (hLocation.getPath().equals("/_replies")) { - logger.info(String.format("user %d connected to legacy _replies (%s)", visitor.getUid(), hLocation.getPath())); + logger.info("user {} connected to legacy _replies ({})", visitor.getUid(), hLocation.getPath()); sockSubscr = new SocketSubscribed(session, hXRealIP, visitor, true); sockSubscr.allReplies = true; } else if (hLocation.getPath().matches("/\\d+$")) { @@ -83,7 +83,7 @@ public class WebsocketComponent extends TextWebSocketHandler { } if (MID > 0) { if (messagesService.canViewThread(MID, visitor.getUid())) { - logger.info(String.format("user %d connected to legacy thread (%d) from %s", visitor.getUid(), MID, hXRealIP)); + logger.info("user {} connected to legacy thread ({}) from {}", visitor.getUid(), MID, hXRealIP); sockSubscr = new SocketSubscribed(session, hXRealIP, visitor, true); sockSubscr.MID = MID; } else { @@ -98,7 +98,7 @@ public class WebsocketComponent extends TextWebSocketHandler { if (sockSubscr != null) { synchronized (clients) { clients.add(sockSubscr); - logger.info(clients.size() + " clients connected"); + logger.info("{} clients connected", clients.size()); } } } @@ -106,14 +106,14 @@ public class WebsocketComponent extends TextWebSocketHandler { @Override public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception { synchronized (clients) { - logger.info(String.format("session closed with status %d: %s", status.getCode(), status.getReason())); + logger.info("session closed with status {}: {}", status.getCode(), status.getReason()); clients.removeIf(c -> { if (c.session.getId().equals(session.getId())) { return true; } return false; }); - logger.info(clients.size() + " clients connected"); + logger.info("{} clients connected", clients.size()); } } |