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
+8 -5
View File
@@ -13,6 +13,9 @@ import { auth } from "$lib/stores/auth";
// hand-written mirror — the mirror had already drifted (it predates `itemName`),
// and a drifted duplicate is how a field silently stops reaching the UI.
import type { SyncQueueItem } from "$lib/api/bindings";
import { createLogger } from "$lib/utils/logger";
const log = createLogger("SyncService");
export type { SyncQueueItem };
export type SyncOperation =
@@ -42,14 +45,14 @@ class SyncService {
* Start the sync service (lifecycle managed by Rust backend)
*/
start(): void {
console.log("[SyncService] Started");
log.debug("Started");
}
/**
* Stop the sync service (lifecycle managed by Rust backend)
*/
stop(): void {
console.log("[SyncService] Stopped");
log.debug("Stopped");
}
/**
@@ -74,7 +77,7 @@ class SyncService {
payload ? JSON.stringify(payload) : null
);
console.log(`[SyncService] Queued ${operation} for item ${itemId}, id: ${id}`);
log.debug(`Queued ${operation} for item ${itemId}, id: ${id}`);
return id;
}
@@ -155,7 +158,7 @@ class SyncService {
*/
async cleanup(daysOld: number = 7): Promise<number> {
const deleted = await commands.syncCleanupCompleted(daysOld);
console.log(`[SyncService] Cleaned up ${deleted} old completed operations`);
log.debug(`Cleaned up ${deleted} old completed operations`);
return deleted;
}
@@ -194,7 +197,7 @@ class SyncService {
const userId = auth.getUserId();
if (userId) {
await commands.syncClearUser(userId);
console.log("[SyncService] Cleared sync queue for user");
log.debug("Cleared sync queue for user");
}
}
}