Add verbose debug logging across services and cron jobs

Add createLogger to tmdb client, image-cache, availability, and
webhooks services. Replace all silent .catch(() => {}) in metadata.ts
with debug-level error logging. Add progress and success logs in cron
job bodies, colors extraction, and webhook processing. Fix pre-existing
unused parameter lint warning in title-card.tsx.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-05 12:46:06 -05:00
co-authored by Claude Opus 4.6
parent 2d691c3591
commit 704aca1103
8 changed files with 156 additions and 35 deletions
+9
View File
@@ -1,3 +1,4 @@
import { createLogger } from "@/lib/logger";
import type {
TmdbFindResult,
TmdbGenreListResponse,
@@ -9,6 +10,8 @@ import type {
TmdbWatchProviderResponse,
} from "./types";
const log = createLogger("tmdb");
const BASE_URL =
process.env.TMDB_API_BASE_URL || "https://api.themoviedb.org/3";
function getApiKey() {
@@ -29,6 +32,7 @@ async function tmdbFetch<T>(
}
}
const start = performance.now();
const res = await fetch(url.toString(), {
...fetchOptions,
headers: {
@@ -37,11 +41,16 @@ async function tmdbFetch<T>(
...fetchOptions?.headers,
},
});
const elapsed = Math.round(performance.now() - start);
if (!res.ok) {
log.warn(
`${url.toString()} -> ${res.status} ${res.statusText} (${elapsed}ms)`,
);
throw new Error(`TMDB API error: ${res.status} ${res.statusText}`);
}
log.debug(`${url.toString()} -> ${res.status} (${elapsed}ms)`);
return res.json() as Promise<T>;
}