refactor: structured logging across server
Create server/src/lib/logger.ts with info/warn/error methods that add [botfights:tag] timestamps. Replace bare console.log/warn/error calls in index.ts, seed.ts, routes/fights.ts, engine/queue.ts, engine/mock.ts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
7bd110684d
commit
f62323c59f
@@ -1,4 +1,5 @@
|
||||
import { Hono } from 'hono'
|
||||
import { logger } from '../lib/logger.js'
|
||||
import { streamSSE } from 'hono/streaming'
|
||||
import { db, schema } from '../db/index.js'
|
||||
import { eq, desc } from 'drizzle-orm'
|
||||
@@ -175,8 +176,8 @@ fightsRouter.post('/mock/batch/:count', async (c) => {
|
||||
const capped = Math.min(count, 500)
|
||||
|
||||
startFightLoop({ maxFights: capped, intervalMs: 500, matchmakingStyle: 'mixed' })
|
||||
.then(() => console.log(`[botfights] batch of ${capped} fights completed`))
|
||||
.catch(err => console.error('[botfights] batch error:', err))
|
||||
.then(() => logger.info('fights', `batch of ${capped} fights completed`))
|
||||
.catch(err => logger.error('fights', 'batch error', err))
|
||||
|
||||
return c.json({ message: `Started batch of ${capped} fights in background.` })
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user