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
+9 -5
View File
@@ -13,6 +13,10 @@
* so there is no HTML5 fallback to reach for.
*/
import { createLogger } from "$lib/utils/logger";
const log = createLogger("PiP");
interface AndroidPictureInPictureBridge {
enterPip(): void;
isSupported(): boolean;
@@ -41,7 +45,7 @@ export function isPipSupported(): boolean {
try {
return bridge()?.isSupported() ?? false;
} catch (err) {
console.warn("[PiP] isSupported check failed:", err);
log.warn("isSupported check failed:", err);
return false;
}
}
@@ -54,7 +58,7 @@ export function canEnterPip(): boolean {
try {
return bridge()?.canEnterPip() ?? false;
} catch (err) {
console.warn("[PiP] canEnterPip check failed:", err);
log.warn("canEnterPip check failed:", err);
return false;
}
}
@@ -64,7 +68,7 @@ export function enterPip(): void {
try {
bridge()?.enterPip();
} catch (err) {
console.error("[PiP] Failed to enter picture-in-picture:", err);
log.error("Failed to enter picture-in-picture:", err);
}
}
@@ -82,7 +86,7 @@ export function setAutoEnterEnabled(enabled: boolean): void {
try {
bridge()?.setAutoEnterEnabled(enabled);
} catch (err) {
console.warn("[PiP] Failed to set auto-enter:", err);
log.warn("Failed to set auto-enter:", err);
}
}
@@ -115,6 +119,6 @@ export function setHtml5VideoState(
try {
bridge()?.setHtml5VideoState(active, Math.round(width), Math.round(height), playing);
} catch (err) {
console.warn("[PiP] Failed to report HTML5 video state:", err);
log.warn("Failed to report HTML5 video state:", err);
}
}