mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 01:35:39 -04:00
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:
@@ -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>;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user