chore: improve logging in arcade session management
Added detailed logging to help debug player ID vs user ID flow: - useArcadeSocket: Log full move payload with JSON stringification - session-manager: Log player ID, game state players, and phase info 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
ea1b1a2f69
commit
2248c34215
|
|
@ -124,8 +124,9 @@ export function useArcadeSocket(events: ArcadeSocketEvents = {}): UseArcadeSocke
|
|||
console.warn('[ArcadeSocket] Cannot send move - socket not connected')
|
||||
return
|
||||
}
|
||||
console.log('[ArcadeSocket] Sending move:', move)
|
||||
socket.emit('game-move', { userId, move })
|
||||
const payload = { userId, move }
|
||||
console.log('[ArcadeSocket] Sending game-move event with payload:', JSON.stringify(payload, null, 2))
|
||||
socket.emit('game-move', payload)
|
||||
}, [socket])
|
||||
|
||||
const exitSession = useCallback((userId: string) => {
|
||||
|
|
|
|||
|
|
@ -129,9 +129,22 @@ export async function applyGameMove(
|
|||
// Get the validator for this game
|
||||
const validator = getValidator(session.currentGame as GameName)
|
||||
|
||||
console.log('[SessionManager] About to validate move:', {
|
||||
moveType: move.type,
|
||||
playerId: move.playerId,
|
||||
gameStateCurrentPlayer: (session.gameState as any)?.currentPlayer,
|
||||
gameStateActivePlayers: (session.gameState as any)?.activePlayers,
|
||||
gameStatePhase: (session.gameState as any)?.gamePhase
|
||||
})
|
||||
|
||||
// Validate the move
|
||||
const validationResult = validator.validateMove(session.gameState, move)
|
||||
|
||||
console.log('[SessionManager] Validation result:', {
|
||||
valid: validationResult.valid,
|
||||
error: validationResult.error
|
||||
})
|
||||
|
||||
if (!validationResult.valid) {
|
||||
return {
|
||||
success: false,
|
||||
|
|
|
|||
Loading…
Reference in New Issue