mirror of
https://github.com/juherr/kill-the-news.git
synced 2026-06-20 22:03:48 +00:00
feat: add structured JSON logger and worker utility (P1-4)
Introduces src/lib/logger.ts emitting JSON lines (level, message, data) compatible with Cloudflare Logpush. Replaces all console.log/warn/error calls in email-processor.ts, index.ts, and hub.ts with structured logger calls. Extracts waitUntilSafe into src/utils/worker.ts to avoid duplicating the executionCtx guard across routes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import { Context } from "hono";
|
||||
|
||||
/** Calls ctx.waitUntil() without throwing when the ExecutionContext is absent (e.g. Node tests). */
|
||||
export function waitUntilSafe(c: Context, promise: Promise<unknown>): void {
|
||||
try {
|
||||
c.executionCtx.waitUntil(promise);
|
||||
} catch {
|
||||
// ExecutionContext unavailable in Node test environment — ignore.
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user