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
+12 -9
View File
@@ -13,6 +13,9 @@ import { writable, derived } from "svelte/store";
import { browser } from "$app/environment";
import { listen } from "@tauri-apps/api/event";
import { commands } from "$lib/api/bindings";
import { createLogger } from "$lib/utils/logger";
const log = createLogger("ConnectivityStore");
export interface ConnectivityState {
/** Browser's navigator.onLine status */
@@ -76,7 +79,7 @@ function createConnectivityStore() {
update((s) => ({ ...s, isOnline: true }));
// Device regained network — ask the backend to re-verify the server now.
checkServerReachable().catch((err) => {
console.debug("[ConnectivityStore] Recheck after 'online' failed:", err);
log.debug("Recheck after 'online' failed:", err);
});
});
@@ -85,7 +88,7 @@ function createConnectivityStore() {
// decide whether the server is actually reachable.
update((s) => ({ ...s, isOnline: false }));
checkServerReachable().catch((err) => {
console.debug("[ConnectivityStore] Recheck after 'offline' failed:", err);
log.debug("Recheck after 'offline' failed:", err);
});
});
}
@@ -132,7 +135,7 @@ function createConnectivityStore() {
return isReachable;
} catch (error) {
console.error("[ConnectivityStore] Failed to check server:", error);
log.error("Failed to check server:", error);
return false;
}
}
@@ -145,7 +148,7 @@ function createConnectivityStore() {
isMonitoring = true;
try {
console.log("[ConnectivityStore] Starting monitoring for:", url);
log.debug("Starting monitoring for:", url);
// Set the server URL
await commands.connectivitySetServerUrl(url);
@@ -163,10 +166,10 @@ function createConnectivityStore() {
isChecking: status.isChecking,
}));
console.log("[ConnectivityStore] Started monitoring. Initial status:",
log.debug("Started monitoring. Initial status:",
status.isServerReachable ? "ONLINE" : "OFFLINE");
} catch (error) {
console.error("[ConnectivityStore] Failed to start monitoring:", error);
log.error("Failed to start monitoring:", error);
update((s) => ({
...s,
isServerReachable: false,
@@ -185,9 +188,9 @@ function createConnectivityStore() {
await commands.connectivityStopMonitoring();
isMonitoring = false;
eventHandlers = {};
console.log("[ConnectivityStore] Stopped monitoring");
log.debug("Stopped monitoring");
} catch (error) {
console.error("[ConnectivityStore] Failed to stop monitoring:", error);
log.error("Failed to stop monitoring:", error);
}
}
@@ -198,7 +201,7 @@ function createConnectivityStore() {
try {
await commands.connectivitySetServerUrl(url);
} catch (error) {
console.error("[ConnectivityStore] Failed to set server URL:", error);
log.error("Failed to set server URL:", error);
}
}