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:
Dorian
2026-03-08 20:41:23 +00:00
co-authored by Claude Opus 4.6
parent 7bd110684d
commit f62323c59f
6 changed files with 42 additions and 18 deletions
+19
View File
@@ -0,0 +1,19 @@
function ts(): string {
return new Date().toISOString()
}
export const logger = {
info(tag: string, message: string) {
console.log(`[botfights:${tag}] ${ts()} ${message}`)
},
warn(tag: string, message: string) {
console.warn(`[botfights:${tag}] ${ts()} ${message}`)
},
error(tag: string, message: string, err?: unknown) {
if (err) {
console.error(`[botfights:${tag}] ${ts()} ${message}`, err)
} else {
console.error(`[botfights:${tag}] ${ts()} ${message}`)
}
},
}