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
+7 -4
View File
@@ -15,6 +15,9 @@
import { commands } from "$lib/api/bindings";
import type { AdapterHost } from "./types";
import { createLogger } from "$lib/utils/logger";
const log = createLogger("rustReportHost");
const POSITION_REPORT_INTERVAL_MS = 250;
@@ -37,7 +40,7 @@ export async function reportState(
try {
await commands.playerReportState(state, mediaId);
} catch (err) {
console.warn("[rustReportHost] Failed to report state:", err);
log.warn("Failed to report state:", err);
}
}
@@ -54,7 +57,7 @@ export async function reportPosition(
try {
await commands.playerReportPosition(position, Number.isFinite(duration) ? duration : 0);
} catch (err) {
console.warn("[rustReportHost] Failed to report position:", err);
log.warn("Failed to report position:", err);
}
}
@@ -62,7 +65,7 @@ export async function reportMediaLoaded(duration: number): Promise<void> {
try {
await commands.playerReportMediaLoaded(Number.isFinite(duration) ? duration : 0);
} catch (err) {
console.warn("[rustReportHost] Failed to report media loaded:", err);
log.warn("Failed to report media loaded:", err);
}
}
@@ -85,7 +88,7 @@ export function createRustReportHost(
onPosition: (position, duration) => void reportPosition(position, duration),
onMediaLoaded: (duration) => void reportMediaLoaded(duration),
onEnded: view.onEnded ?? (() => {}),
onError: view.onError ?? ((message) => console.warn("[rustReportHost] adapter error:", message)),
onError: view.onError ?? ((message) => log.warn("adapter error:", message)),
onStreamUrlChanged: view.onStreamUrlChanged ?? (() => {}),
onBuffering: view.onBuffering ?? (() => {}),
onReady: view.onReady ?? (() => {}),