Clean up console logging and fix platform detection issues

- Reduce migration/platform logging verbosity in development mode (~80-90% less noise)
- Fix AbsurdSQL platform check to support 'development' alongside 'web'
- Add missing WebPlatformService methods (isWorker, initSharedArrayBuffer)
- Fix Electron API endpoint resolution to prevent JSON parsing errors
- Prevent circular database logging that caused [DB-PREVENTED-INFO] spam

Console now shows only essential information while preserving all errors/warnings
This commit is contained in:
Matthew Raymer
2025-07-03 06:31:43 +00:00
parent 7d5e81263c
commit a5eb5cacaf
8 changed files with 162 additions and 46 deletions

View File

@@ -48,15 +48,21 @@ export class WebPlatformService implements PlatformService {
constructor() {
WebPlatformService.instanceCount++;
// Only warn if multiple instances (which shouldn't happen with singleton)
if (WebPlatformService.instanceCount > 1) {
console.error(
`[WebPlatformService] ERROR: Multiple instances created! Count: ${WebPlatformService.instanceCount}`,
);
} else {
console.log(`[WebPlatformService] Initializing web platform service`);
// Use debug level logging for development mode to reduce console noise
const isDevelopment = process.env.VITE_PLATFORM === "development";
const log = isDevelopment ? logger.debug : logger.log;
log("[WebPlatformService] Initializing web platform service");
// Only initialize SharedArrayBuffer setup for web platforms
if (this.isWorker()) {
log("[WebPlatformService] Skipping initBackend call in worker context");
return;
}
// Initialize shared array buffer for main thread
this.initSharedArrayBuffer();
// Start worker initialization but don't await it in constructor
this.workerInitPromise = this.initializeWorker();
}
@@ -629,4 +635,18 @@ export class WebPlatformService implements PlatformService {
async rotateCamera(): Promise<void> {
throw new Error("Camera rotation not implemented in web platform");
}
/**
* Checks if running in a worker context
*/
private isWorker(): boolean {
return typeof window === "undefined";
}
/**
* Initialize SharedArrayBuffer setup (handled by initBackend in initializeWorker)
*/
private initSharedArrayBuffer(): void {
// SharedArrayBuffer initialization is handled by initBackend call in initializeWorker
}
}