diff options
author | joffrey-bion <joffrey.bion@gmail.com> | 2020-12-12 19:41:53 +0100 |
---|---|---|
committer | joffrey-bion <joffrey.bion@gmail.com> | 2020-12-12 19:41:53 +0100 |
commit | 31cde8f6161eca639f6ae692dff200637acfc6fb (patch) | |
tree | a9a4b304c4f4dd0a6b127f87c21936df25b41cc6 /sw-server/src/main | |
parent | Fix race conditions for game start and tests (diff) | |
download | seven-wonders-31cde8f6161eca639f6ae692dff200637acfc6fb.tar.gz seven-wonders-31cde8f6161eca639f6ae692dff200637acfc6fb.tar.bz2 seven-wonders-31cde8f6161eca639f6ae692dff200637acfc6fb.zip |
Improve logs
Diffstat (limited to 'sw-server/src/main')
-rw-r--r-- | sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/GameController.kt | 9 | ||||
-rw-r--r-- | sw-server/src/main/kotlin/org/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 } |