fix: Clean up excessive debug logging in JavaScript console

- Add conditional verbose logging controlled by ?verbose URL param or localStorage
- Reduce frequent WebSocket message logging to verbose mode only
- Minimize aircraft position update logging to prevent console spam
- Make 3D radar initialization logging conditional on verbose flag
- Reduce WebSocket message counter frequency from every 10 to every 500 messages
- Preserve important error messages and connection status logging

Users can enable verbose logging with:
- URL parameter: http://localhost:8080?verbose
- localStorage: localStorage.setItem('skyview-verbose', 'true')

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2025-09-01 20:30:41 +02:00
commit 2ba2192044
3 changed files with 90 additions and 38 deletions

View file

@ -109,8 +109,8 @@ export class AircraftManager {
this.aircraftData.set(icao, aircraft);
}
// Debug logging for track propagation issues
if (newCount > 0 || positionChanges > 0) {
// Debug logging for track propagation issues (only if significant changes)
if (newCount > 0 || (positionChanges > 5 && window.skyviewVerbose)) {
console.debug(`Aircraft update: ${newCount} new, ${updatedCount} updated, ${positionChanges} position changes`);
}
}
@ -167,7 +167,10 @@ export class AircraftManager {
// If no coordinates, we still want to process for other updates (trails, etc.)
}
console.debug(`Markers update complete: ${this.aircraftMarkers.size} active markers, ${this.aircraftData.size} aircraft`);
// Only log marker updates in verbose mode
if (window.skyviewVerbose) {
console.debug(`Markers update complete: ${this.aircraftMarkers.size} active markers, ${this.aircraftData.size} aircraft`);
}
}
updateAircraftMarker(icao, aircraft) {
@ -196,7 +199,10 @@ export class AircraftManager {
if (positionChanged) {
// Debug significant position updates
console.debug(`Position change for ${icao}: [${pos[0].toFixed(4)}, ${pos[1].toFixed(4)}] (was [${oldPos.lat.toFixed(4)}, ${oldPos.lng.toFixed(4)}])`);
// Only log individual position changes in verbose mode
if (window.skyviewVerbose) {
console.debug(`Position change for ${icao}: [${pos[0].toFixed(4)}, ${pos[1].toFixed(4)}] (was [${oldPos.lat.toFixed(4)}, ${oldPos.lng.toFixed(4)}])`);
}
}
// Check if icon needs to be updated (track rotation, aircraft type, or ground status changes)

View file

@ -53,8 +53,8 @@ export class WebSocketManager {
this.lastMessageTime = Date.now();
this.messageCount++;
// Log message reception for debugging
if (this.messageCount % 10 === 0) {
// Only log message counts in verbose mode and less frequently
if (window.skyviewVerbose && this.messageCount % 500 === 0) {
console.debug(`Received ${this.messageCount} WebSocket messages`);
}