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
+10 -7
View File
@@ -29,6 +29,9 @@
} from "$lib/services/networkType";
import { experimentalNativeVideo } from "$lib/stores/nativeVideo";
import { getPlaybackCapabilities } from "$lib/services/playbackCapabilities";
import { createLogger } from "$lib/utils/logger";
const log = createLogger("SettingsPage");
const episodeLimitOptions = [
{ value: 0, label: "Unlimited" },
@@ -153,7 +156,7 @@
// Load cache stats in parallel but don't block on it
loadCacheStats();
} catch (e) {
console.error("Failed to load settings:", e);
log.error("Failed to load settings:", e);
} finally {
loading = false;
}
@@ -164,7 +167,7 @@
cacheLoading = true;
cacheStats = await getCacheStats();
} catch (e) {
console.error("Failed to load cache stats:", e);
log.error("Failed to load cache stats:", e);
} finally {
cacheLoading = false;
}
@@ -176,7 +179,7 @@
// Reload stats to reflect new limit
await loadCacheStats();
} catch (e) {
console.error("Failed to set cache limit:", e);
log.error("Failed to set cache limit:", e);
}
}
@@ -186,7 +189,7 @@
await clearCache();
await loadCacheStats();
} catch (e) {
console.error("Failed to clear cache:", e);
log.error("Failed to clear cache:", e);
} finally {
clearingCache = false;
}
@@ -214,7 +217,7 @@
try {
await commands.playerSetAudioSettings(settings);
} catch (e) {
console.error("Failed to save audio settings:", e);
log.error("Failed to save audio settings:", e);
}
}
@@ -222,7 +225,7 @@
try {
await commands.playerSetVideoSettings(videoSettings);
} catch (e) {
console.error("Failed to save video settings:", e);
log.error("Failed to save video settings:", e);
}
}
@@ -234,7 +237,7 @@
// rather than at the next network change.
await reportNetworkState();
} catch (e) {
console.error("Failed to save download settings:", e);
log.error("Failed to save download settings:", e);
}
}