From 46ba8e32194a18d48c02c612fad0f332b3a87531 Mon Sep 17 00:00:00 2001 From: Ben Stein Date: Thu, 14 Sep 2023 10:03:38 -0400 Subject: [PATCH] Add additional logging for external game start --- .../src/app/game/pages/game-page/game-page.component.ts | 3 ++- projects/gameboard-ui/src/app/guards/user-is-playing.guard.ts | 2 +- .../gameboard-ui/src/app/services/signalR/signalr.service.ts | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/projects/gameboard-ui/src/app/game/pages/game-page/game-page.component.ts b/projects/gameboard-ui/src/app/game/pages/game-page/game-page.component.ts index e67567a0..9ec4fa67 100644 --- a/projects/gameboard-ui/src/app/game/pages/game-page/game-page.component.ts +++ b/projects/gameboard-ui/src/app/game/pages/game-page/game-page.component.ts @@ -283,13 +283,14 @@ export class GamePageComponent implements OnDestroy { return; } - this.logService.logInfo(`Game ${ctx.game.id} (player ${ctx.playerId}) is ${startState.isReady ? "" : "not"} ready to start.`); + this.logService.logWarning(`Game ${ctx.game.id} (player ${ctx.playerId}) is ${startState.isReady ? "" : "not"} ready to start.`); // NOTE: in https://github.com/cmu-sei/Gameboard/issues/249, we're tracking the fact that we really need a separate // data structure to record properties of the external game, including a better way to determine if we should redirect // a reloading/returning player to the game screen if (startState.isReady && ctx.game.session.isDuring && ctx.playerId) { + this.logService.logWarning(`Game ${ctx.game.id} (player ${ctx.playerId}) is starting...`); this.routerService.goToGameStartPage({ gameId: ctx.game.id, playerId: ctx.playerId }); } } diff --git a/projects/gameboard-ui/src/app/guards/user-is-playing.guard.ts b/projects/gameboard-ui/src/app/guards/user-is-playing.guard.ts index 42f77dfe..7b12d085 100644 --- a/projects/gameboard-ui/src/app/guards/user-is-playing.guard.ts +++ b/projects/gameboard-ui/src/app/guards/user-is-playing.guard.ts @@ -39,7 +39,7 @@ export class UserIsPlayingGuard implements CanActivate, CanActivateChild { } // if we only have a player id, we need to resolve the gameId using the playerId - this.log.logInfo(`Checking UserIsPlayingGuard for game ${gameId}, user ${playerId}.`); + this.log.logWarning(`Checking UserIsPlayingGuard for game ${gameId}, user ${playerId}.`); let resolvedGameId = gameId; if (playerId) { const player = await firstValueFrom(this.playerService.retrieve(playerId)); diff --git a/projects/gameboard-ui/src/app/services/signalR/signalr.service.ts b/projects/gameboard-ui/src/app/services/signalR/signalr.service.ts index d045ca56..e4824d70 100644 --- a/projects/gameboard-ui/src/app/services/signalR/signalr.service.ts +++ b/projects/gameboard-ui/src/app/services/signalR/signalr.service.ts @@ -62,6 +62,9 @@ export class SignalRService { if (this._connection?.state == HubConnectionState.Connected) { this.logger.logInfo(`Connection started with url`, connectToUrl); } + else if (this._connection.state == HubConnectionState.Connecting || this._connection?.state == HubConnectionState.Reconnecting) { + this.logger.logWarning(`Connection with url ${connectToUrl} is in the Connecting state...`); + } else { this.logger.logError(`CRITICAL: The SignalR service was unable to join hub "${connectToUrl}".`); }