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:
@@ -34,6 +34,9 @@
|
||||
import { useScrollRestore } from "$lib/utils/scrollContainer";
|
||||
import { startNetworkReporting } from "$lib/services/networkType";
|
||||
import { initSafeArea } from "$lib/utils/safeArea";
|
||||
import { createLogger } from "$lib/utils/logger";
|
||||
|
||||
const log = createLogger("Layout");
|
||||
|
||||
let { children } = $props();
|
||||
|
||||
@@ -105,7 +108,7 @@
|
||||
const platformName = platform();
|
||||
isAndroid.set(platformName === "android");
|
||||
} catch (err) {
|
||||
console.error("Platform detection failed:", err);
|
||||
log.error("Platform detection failed:", err);
|
||||
}
|
||||
|
||||
// Prime the safe-area custom properties from the native WindowInsets bridge
|
||||
@@ -154,7 +157,7 @@
|
||||
const userId = get(auth).user?.id;
|
||||
if (userId) {
|
||||
downloads.refresh(userId).catch((err) =>
|
||||
console.error("Initial downloads refresh failed:", err)
|
||||
log.error("Initial downloads refresh failed:", err)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -168,7 +171,7 @@
|
||||
// without spending their retry budget (DR-131).
|
||||
if (get(auth).user?.id) {
|
||||
commands.syncProcessPending().catch((err) =>
|
||||
console.debug("[Layout] Startup sync drain skipped:", err)
|
||||
log.debug("Startup sync drain skipped:", err)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -206,7 +209,7 @@
|
||||
if (session?.serverUrl) {
|
||||
connectivity.forceCheck().catch((error) => {
|
||||
// If check fails, monitoring might not be started yet, so start it
|
||||
console.debug("[Layout] Queue status check failed, starting monitoring:", error);
|
||||
log.debug("Queue status check failed, starting monitoring:", error);
|
||||
connectivity.startMonitoring(session.serverUrl, {
|
||||
onServerReconnected: () => {
|
||||
// Retry session verification when server becomes reachable
|
||||
@@ -215,7 +218,7 @@
|
||||
void onCatalogReconnected();
|
||||
},
|
||||
}).catch((monitorError) => {
|
||||
console.error("[Layout] Failed to start connectivity monitoring:", monitorError);
|
||||
log.error("Failed to start connectivity monitoring:", monitorError);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -242,7 +245,7 @@
|
||||
.then((unlisten) => {
|
||||
unlistenDrain = unlisten;
|
||||
})
|
||||
.catch((err) => console.debug("[Layout] sync-queue-changed listen failed:", err));
|
||||
.catch((err) => log.debug("sync-queue-changed listen failed:", err));
|
||||
|
||||
return () => {
|
||||
clearInterval(interval);
|
||||
|
||||
Reference in New Issue
Block a user