refactor: replace console.log/error with structured logger across server

Migrate all server modules to use the centralized logger (lib/logger.ts)
instead of raw console calls. Lint warnings reduced from 74 to 25.
Remaining warnings are only no-floating-promises in game engine code.

Files updated: orchestrator.ts, ranked-queue.ts, human-responses.ts,
payments.ts, fight-loop.ts, app.ts, routes/payments.ts
Files suppressed: logger.ts, fight-loop-cli.ts, migrate.ts (legitimate console use)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-09 09:06:36 +00:00
co-authored by Claude Opus 4.6
parent 1f532681df
commit 4cc18048e8
10 changed files with 70 additions and 62 deletions
+4 -3
View File
@@ -2,6 +2,7 @@
// When the fight engine needs a human's response, it stores the challenge here
// and waits for the browser to submit the answer via REST.
import { logger } from '../lib/logger.js'
import type { Challenge } from './challenges.js'
import { getAnswerPool } from './challenges.js'
@@ -243,7 +244,7 @@ export function waitForHumanResponse(
const timeoutHandle = setTimeout(() => {
pending.delete(key)
console.log(`[human] ${key} timed out after ${timeoutMs}ms`)
logger.info('human', `${key} timed out after ${timeoutMs}ms`)
resolve({ answer: null, timedOut: true })
}, timeoutMs)
@@ -264,7 +265,7 @@ export function waitForHumanResponse(
timeoutHandle,
})
console.log(`[human] waiting: ${key} round=${roundNumber} type=${challenge.type} choices=${choices.length}`)
logger.info('human', `waiting: ${key} round=${roundNumber} type=${challenge.type} choices=${choices.length}`)
})
}
@@ -277,7 +278,7 @@ export function submitHumanResponse(
const key = `${fightId}:${botId}`
const entry = pending.get(key)
if (!entry) return false
console.log(`[human] response: ${key} answer=${answer.slice(0, 80)}`)
logger.info('human', `response: ${key} answer=${answer.slice(0, 80)}`)
entry.resolve({ answer: answer.slice(0, 2000), trashTalk: trashTalk?.slice(0, 200) })
return true
}