From 838723c26b82df46551c3360d77e6031c7791d2d Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Fri, 20 Jun 2025 14:01:08 -0600 Subject: [PATCH] remove debugging info messages (change to debug if we want these -- and tell us how to turn off debug locally) --- src/main.common.ts | 25 ++----------------------- src/main.web.ts | 5 +---- src/services/migrationService.ts | 17 ----------------- src/utils/logger.ts | 14 ++++---------- 4 files changed, 7 insertions(+), 54 deletions(-) diff --git a/src/main.common.ts b/src/main.common.ts index cb44cd6f..27d06333 100644 --- a/src/main.common.ts +++ b/src/main.common.ts @@ -10,15 +10,11 @@ import { FontAwesomeIcon } from "./libs/fontawesome"; import Camera from "simple-vue-camera"; import { logger } from "./utils/logger"; -const platform = process.env.VITE_PLATFORM; -const pwa_enabled = process.env.VITE_PWA_ENABLED === "true"; - -logger.log("Platform", JSON.stringify({ platform })); -logger.log("PWA enabled", JSON.stringify({ pwa_enabled })); +// const platform = process.env.VITE_PLATFORM; +// const pwa_enabled = process.env.VITE_PWA_ENABLED === "true"; // Global Error Handler function setupGlobalErrorHandler(app: VueApp) { - logger.log("[App Init] Setting up global error handler"); app.config.errorHandler = ( err: unknown, instance: ComponentPublicInstance | null, @@ -38,30 +34,13 @@ function setupGlobalErrorHandler(app: VueApp) { // Function to initialize the app export function initializeApp() { - logger.log("[App Init] Starting app initialization"); - logger.log("[App Init] Platform:", process.env.VITE_PLATFORM); - const app = createApp(App); - logger.log("[App Init] Vue app created"); - app.component("FontAwesome", FontAwesomeIcon).component("camera", Camera); - logger.log("[App Init] Components registered"); - const pinia = createPinia(); app.use(pinia); - logger.log("[App Init] Pinia store initialized"); - app.use(VueAxios, axios); - logger.log("[App Init] Axios initialized"); - app.use(router); - logger.log("[App Init] Router initialized"); - app.use(Notifications); - logger.log("[App Init] Notifications initialized"); - setupGlobalErrorHandler(app); - logger.log("[App Init] App initialization complete"); - return app; } diff --git a/src/main.web.ts b/src/main.web.ts index dc5d1e56..ff149056 100644 --- a/src/main.web.ts +++ b/src/main.web.ts @@ -5,9 +5,6 @@ import { logger } from "./utils/logger"; const platform = process.env.VITE_PLATFORM; const pwa_enabled = process.env.VITE_PWA_ENABLED === "true"; -logger.info("[Web] PWA enabled", { pwa_enabled }); -logger.info("[Web] Platform", { platform }); - // Only import service worker for web builds if (platform !== "electron" && pwa_enabled) { import("./registerServiceWorker"); // Web PWA support @@ -31,7 +28,7 @@ function sqlInit() { if (platform === "web" || platform === "development") { sqlInit(); } else { - logger.info("[Web] SQL not initialized for platform", { platform }); + logger.warn("[Web] SQL not initialized for platform", { platform }); } app.mount("#app"); diff --git a/src/services/migrationService.ts b/src/services/migrationService.ts index 00587967..089c7d65 100644 --- a/src/services/migrationService.ts +++ b/src/services/migrationService.ts @@ -25,7 +25,6 @@ class MigrationRegistry { */ registerMigration(migration: Migration): void { this.migrations.push(migration); - logger.info(`[MigrationService] Registered migration: ${migration.name}`); } /** @@ -42,7 +41,6 @@ class MigrationRegistry { */ clearMigrations(): void { this.migrations = []; - logger.info("[MigrationService] Cleared all registered migrations"); } } @@ -94,10 +92,6 @@ export async function runMigrations( ); const appliedMigrations = extractMigrationNames(appliedMigrationsResult); - logger.info( - `[MigrationService] Found ${appliedMigrations.size} applied migrations`, - ); - // Get all registered migrations const migrations = migrationRegistry.getMigrations(); @@ -106,21 +100,12 @@ export async function runMigrations( return; } - logger.info( - `[MigrationService] Running ${migrations.length} registered migrations`, - ); - // Run each migration that hasn't been applied yet for (const migration of migrations) { if (appliedMigrations.has(migration.name)) { - logger.info( - `[MigrationService] Skipping already applied migration: ${migration.name}`, - ); continue; } - logger.info(`[MigrationService] Applying migration: ${migration.name}`); - try { // Execute the migration SQL await sqlExec(migration.sql); @@ -141,8 +126,6 @@ export async function runMigrations( throw new Error(`Migration ${migration.name} failed: ${error}`); } } - - logger.info("[MigrationService] All migrations completed successfully"); } catch (error) { logger.error("[MigrationService] Migration process failed:", error); throw error; diff --git a/src/utils/logger.ts b/src/utils/logger.ts index 89425d77..8184c28b 100644 --- a/src/utils/logger.ts +++ b/src/utils/logger.ts @@ -52,16 +52,10 @@ export const logger = { } }, warn: (message: string, ...args: unknown[]) => { - if ( - process.env.NODE_ENV !== "production" || - process.env.VITE_PLATFORM === "capacitor" || - process.env.VITE_PLATFORM === "electron" - ) { - // eslint-disable-next-line no-console - console.warn(message, ...args); - const argsString = args.length > 0 ? " - " + safeStringify(args) : ""; - logToDb(message + argsString); - } + // eslint-disable-next-line no-console + console.warn(message, ...args); + const argsString = args.length > 0 ? " - " + safeStringify(args) : ""; + logToDb(message + argsString); }, error: (message: string, ...args: unknown[]) => { // Errors will always be logged