Replace console statements with structured logger calls
- Replace 30 console.log/error/warn statements with appropriate logger calls - Add logger imports where missing (PlatformServiceFactory, PlatformServiceMixin) - Maintain eslint-disable comments for critical error logging in worker context - Improve error handling consistency across platform services - Clean up commented-out logger statements in WebPlatformService Files affected: - src/db/databaseUtil.ts: 4 console statements → logger calls - src/main.electron.ts: 3 console statements → logger calls - src/registerSQLWorker.js: 9 console statements → logger calls - src/services/PlatformServiceFactory.ts: 1 console statement → logger call - src/services/platforms/WebPlatformService.ts: 8 console statements → logger calls - src/utils/PlatformServiceMixin.ts: 5 console statements → logger calls Reduces ESLint warnings from 111 to 82 (eliminates all no-console warnings)
This commit is contained in:
@@ -204,6 +204,7 @@ export async function logToDb(
|
||||
// Prevent infinite logging loops - if we're already trying to log to database,
|
||||
// just log to console instead to break circular dependency
|
||||
if (isLoggingToDatabase) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`[DB-PREVENTED-${level.toUpperCase()}] ${message}`);
|
||||
return;
|
||||
}
|
||||
@@ -238,6 +239,7 @@ export async function logToDb(
|
||||
lastCleanupDate = todayKey;
|
||||
}
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(
|
||||
"Error logging to database:",
|
||||
error,
|
||||
@@ -257,9 +259,9 @@ export async function logConsoleAndDb(
|
||||
isError = false,
|
||||
): Promise<void> {
|
||||
if (isError) {
|
||||
console.error(message);
|
||||
logger.error(message);
|
||||
} else {
|
||||
console.log(message);
|
||||
logger.log(message);
|
||||
}
|
||||
|
||||
await logToDb(message, isError ? "error" : "info");
|
||||
|
||||
Reference in New Issue
Block a user