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
@@ -4,6 +4,9 @@
import { auth } from "$lib/stores/auth";
import type { MediaItem, MediaKind, Person } from "$lib/api/types";
import MediaCard from "./MediaCard.svelte";
import { createLogger } from "$lib/utils/logger";
const log = createLogger("RelatedItemsSection");
interface Props {
currentItemId: string;
@@ -57,7 +60,7 @@
return; // Success - return early
}
} catch (e) {
console.warn("Failed to load similar items from API:", e);
log.warn("Failed to load similar items from API:", e);
// Fall through to genre-based loading
}
}
@@ -78,7 +81,7 @@
items = result.items.filter(item => item.id !== currentItemId);
} catch (e) {
console.warn("Failed to load related items by genre:", e);
log.warn("Failed to load related items by genre:", e);
}
}
@@ -94,7 +97,7 @@
const artistAlbums = result.items.filter(item => item.id !== currentItemId);
items = [...items, ...artistAlbums];
} catch (e) {
console.warn("Failed to load albums by artist:", e);
log.warn("Failed to load albums by artist:", e);
}
}
@@ -106,7 +109,7 @@
relatedItems = uniqueItems;
} catch (e) {
error = e instanceof Error ? e.message : "Failed to load related items";
console.error("Error loading related items:", e);
log.error("Error loading related items:", e);
} finally {
loading = false;
}