refactor(logging): route frontend console calls through the logger

TRACES: | DR-204

484 ungated `console.*` calls across 63 non-test frontend files shipped to
end users with no way to turn them off. Mechanical substitution, no control
flow, error handling or message semantics changed:

  console.log / console.debug -> log.debug
  console.info                -> log.info
  console.warn                -> log.warn
  console.error               -> log.error

Hand-written `"[Scope] …"` prefixes are dropped where the logger's scope
now carries them; scope names that already existed are preserved verbatim
(`[Auth]`, `[VideoPlayer]`, `[PiP]`, …) and inferred from the filename
where a file had none. `src/routes/player/[id]/+page.svelte` keeps its
`NextEpisode` and `AutoPlay` sub-scopes as separate loggers rather than
flattening them into the page scope.

`grep -rn 'console\.' src/` now matches nothing outside the tests and the
facade itself.
This commit is contained in:
2026-08-20 19:29:59 +02:00
parent 4c82a0a025
commit d54d8cc7c4
63 changed files with 686 additions and 490 deletions
@@ -3,6 +3,9 @@
import { auth } from "$lib/stores/auth";
import { commands } from "$lib/api/bindings";
import { QUALITY_PRESETS, type QualityPreset } from "$lib/api/quality-presets";
import { createLogger } from "$lib/utils/logger";
const log = createLogger("SeriesDownloadButton");
interface Props {
seriesId: string;
@@ -40,11 +43,11 @@
try {
const userId = $auth.user?.id;
if (!userId) {
console.error("No user ID found");
log.error("No user ID found");
return;
}
console.log("📺 Starting series download for:", seriesName, "quality:", quality);
log.debug("📺 Starting series download for:", seriesName, "quality:", quality);
// Get target directory
const targetDir = await commands.storageGetPath();
@@ -59,7 +62,7 @@
quality
);
console.log(` Queued ${downloadIds.length} episodes for download`);
log.debug(` Queued ${downloadIds.length} episodes for download`);
// Pin the series item
await downloads.pinItem(seriesId);
@@ -69,9 +72,9 @@
// rest as slots free up.
const handle = auth.getRepository().getHandle();
await commands.enqueueVideoDownloads(handle, downloadIds, targetDir);
console.log(" Episodes enqueued; backend pump will start them");
log.debug(" Episodes enqueued; backend pump will start them");
} catch (error) {
console.error("Failed to start series download:", error);
log.error("Failed to start series download:", error);
} finally {
isProcessing = false;
}