From 31cde8f6161eca639f6ae692dff200637acfc6fb Mon Sep 17 00:00:00 2001 From: joffrey-bion Date: Sat, 12 Dec 2020 19:41:53 +0100 Subject: Improve logs --- .../org/luxons/sevenwonders/server/controllers/GameController.kt | 9 +++++---- .../luxons/sevenwonders/server/controllers/LobbyController.kt | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt index 8bd3eb2b..1fbabd59 100644 --- a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt +++ b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt @@ -71,7 +71,7 @@ class GameController( synchronized(game) { val preparedCardBack = game.prepareMove(player.index, action.move) val preparedCard = PreparedCard(player.username, preparedCardBack) - logger.info("Game {}: player {} prepared move {}", game.id, principal.name, action.move) + logger.info("Game {}: player {} prepared move {}", game.id, player, action.move) sendPreparedCard(game.id, preparedCard) if (game.allPlayersPreparedTheirMove()) { @@ -79,6 +79,7 @@ class GameController( game.playTurn() sendTurnInfo(player.lobby.getPlayers(), game, hideHands = lobby.settings.askForReadiness) if (game.endOfGameReached()) { + logger.info("Game {}: end of game, displaying score board", game.id) player.lobby.setEndOfGame() } } else { @@ -95,7 +96,7 @@ class GameController( game.unprepareMove(player.index) } val preparedCard = PreparedCard(player.username, null) - logger.info("Game {}: player {} unprepared his move", game.id, principal.name) + logger.info("Game {}: player {} unprepared his move", game.id, player) sendPreparedCard(game.id, preparedCard) } @@ -120,10 +121,10 @@ class GameController( val game = player.game val lobby = player.lobby lobby.removePlayer(player.username) - logger.info("Game {}: player {} left the game", game.id, principal.name) + logger.info("Game {}: player {} left the game", game.id, player) if (lobby.getPlayers().isEmpty()) { lobbyRepository.remove(lobby.id) - logger.info("Game {}: game deleted", game.id, principal.name) + logger.info("Game {}: game deleted", game.id) } } diff --git a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/LobbyController.kt b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/LobbyController.kt index 79b63bc6..4f5f45bf 100644 --- a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/LobbyController.kt +++ b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/LobbyController.kt @@ -46,7 +46,7 @@ class LobbyController( val player = principal.player val lobby = player.lobby lobby.removePlayer(principal.name) - logger.info("Player {} left game '{}'", player, lobby.name) + logger.info("Player {} left the lobby of game '{}'", player, lobby.name) template.convertAndSendToUser(player.username, "/queue/lobby/left", lobby.id) synchronized(lobby) { @@ -163,7 +163,7 @@ class LobbyController( val lobby = principal.player.ownedLobby val game = lobby.startGame() - logger.info("Game {} successfully started", game.id) + logger.info("Game {} ('{}') successfully started", game.id, lobby.name) val currentTurnInfo = game.getCurrentTurnInfo().let { if (lobby.settings.askForReadiness) it.hideHandsAndWaitForReadiness() else it } -- cgit