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:
Matthew Raymer
2025-07-03 08:32:41 +00:00
parent b377667207
commit 3d7d663f64
6 changed files with 37 additions and 79 deletions

View File

@@ -39,6 +39,7 @@ import type { PlatformService } from "@/services/PlatformService";
import { mapColumnsToValues, parseJsonField } from "@/db/databaseUtil";
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
import * as databaseUtil from "@/db/databaseUtil";
import { logger } from "@/utils/logger";
// =================================================
// CACHING INFRASTRUCTURE
@@ -194,7 +195,7 @@ export const PlatformServiceMixin = {
try {
return await (this as any).platformService.dbQuery(sql, params);
} catch (error) {
console.error(
logger.error(
`[${(this as any).$options.name}] Database query failed:`,
{
sql,
@@ -213,14 +214,11 @@ export const PlatformServiceMixin = {
try {
return await (this as any).platformService.dbExec(sql, params);
} catch (error) {
console.error(
`[${(this as any).$options.name}] Database exec failed:`,
{
sql,
params,
error,
},
);
logger.error(`[${(this as any).$options.name}] Database exec failed:`, {
sql,
params,
error,
});
throw error;
}
},
@@ -232,7 +230,7 @@ export const PlatformServiceMixin = {
try {
return await (this as any).platformService.dbGetOneRow(sql, params);
} catch (error) {
console.error(
logger.error(
`[${(this as any).$options.name}] Database single row query failed:`,
{
sql,
@@ -271,7 +269,7 @@ export const PlatformServiceMixin = {
return settings;
} catch (error) {
console.error(
logger.error(
`[${(this as any).$options.name}] Failed to get settings:`,
{
key,
@@ -336,7 +334,7 @@ export const PlatformServiceMixin = {
return mergedSettings;
} catch (error) {
console.error(
logger.error(
`[${(this as any).$options.name}] Failed to get merged settings:`,
{
defaultKey,