Remove console log statements for cleaner production code across various components and utilities

This commit is contained in:
Miguel 2025-08-16 21:24:55 +02:00
parent e46cc62a0d
commit 2ba244f3aa
7 changed files with 1784 additions and 1715 deletions

File diff suppressed because it is too large Load Diff

View File

@ -32,7 +32,7 @@ const checkChartDependencies = () => {
return false;
}
console.log('✅ Chart.js dependencies verified');
// console.log(' Chart.js dependencies verified');
dependenciesValid = true;
return true;
} catch (error) {
@ -355,7 +355,7 @@ const ChartjsPlot = ({ session, height = '400px' }) => {
resolvedConfigRef.current = sessionConfig;
}
console.log(`🔧 Creating chart for session ${session?.session_id}...`);
// console.log(`🔧 Creating chart for session ${session?.session_id}...`);
try {
// Ensure Chart.js and plugins are loaded
@ -680,7 +680,7 @@ const ChartjsPlot = ({ session, height = '400px' }) => {
setIsLoadingHistorical(false);
}
} else if (variableNames.length > 0) {
console.log(`📊 Historical data loading skipped - session not active (is_active: ${session?.is_active}, is_paused: ${session?.is_paused})`);
// console.log(`📊 Historical data loading skipped - session not active (is_active: ${session?.is_active}, is_paused: ${session?.is_paused})`);
}
const yMinInitial = (typeof config.y_min === 'number' && isFinite(config.y_min)) ? config.y_min : undefined;
@ -925,7 +925,7 @@ const ChartjsPlot = ({ session, height = '400px' }) => {
if (finalExistingChart || hasCanvasProperty || hasReference) {
retryCount++;
console.warn(`⚠️ Attempt ${retryCount}: Chart still exists after cleanup`);
// console.warn(` Attempt ${retryCount}: Chart still exists after cleanup`);
console.warn(`Registry: ${!!finalExistingChart}, Canvas: ${hasCanvasProperty}, Ref: ${hasReference}`);
if (retryCount < maxRetries) {
@ -957,9 +957,9 @@ const ChartjsPlot = ({ session, height = '400px' }) => {
// Safe to create chart
try {
console.log('🚀 Creating new Chart.js instance...');
// console.log('🚀 Creating new Chart.js instance...');
chartRef.current = new Chart(ctx, chartConfig);
console.log('✅ Chart created successfully');
// console.log(' Chart created successfully');
} catch (chartError) {
console.error('❌ Chart creation failed:', chartError);
setError(`Chart creation failed: ${chartError.message}`);
@ -973,7 +973,7 @@ const ChartjsPlot = ({ session, height = '400px' }) => {
const initialPaused = !session?.is_active || session?.is_paused;
sessionDataRef.current.ingestPaused = initialPaused;
sessionDataRef.current.isPaused = initialPaused;
console.log(`✅ Plot ${session?.session_id}: Real-time Streaming enabled`);
// console.log(` Plot ${session?.session_id}: Real-time Streaming enabled`);
setIsLoading(false);
setError(null);
@ -1587,7 +1587,7 @@ const ChartjsPlot = ({ session, height = '400px' }) => {
// Initialize chart when config is resolved - simplified approach
useEffect(() => {
console.log(`🔍 useEffect triggered - sessionId: ${session?.session_id}, hasCanvas: ${!!canvasRef.current}, hasChart: ${!!chartRef.current}`);
// console.log(`🔍 useEffect triggered - sessionId: ${session?.session_id}, hasCanvas: ${!!canvasRef.current}, hasChart: ${!!chartRef.current}`);
// Check dependencies first
if (!checkChartDependencies()) {
@ -1599,7 +1599,7 @@ const ChartjsPlot = ({ session, height = '400px' }) => {
if (session?.session_id && canvasRef.current && !chartRef.current) {
const config = session?.config;
if (config) {
console.log(`🎯 Creating chart for session ${session.session_id} - conditions met`);
// console.log(`🎯 Creating chart for session ${session.session_id} - conditions met`);
// Additional safety check - wait longer for React StrictMode to complete cleanup
setTimeout(() => {
@ -1630,7 +1630,7 @@ const ChartjsPlot = ({ session, height = '400px' }) => {
}
return () => {
console.log('🧹 Cleaning up chart component on unmount...');
// console.log('🧹 Cleaning up chart component on unmount...');
try {
// Enhanced cleanup - check for Chart.js registry first
if (canvasRef.current && document.contains(canvasRef.current)) {

View File

@ -460,10 +460,10 @@ export default function PlotManager() {
setSelectedPlotId(plotsData.plots[0].id)
}
console.log('✅ Plot data loaded:', {
plots: plotsData?.plots?.length || 0,
plotVariables: plotVariablesData?.variables?.length || 0
})
// console.log(' Plot data loaded:', {
// plots: plotsData?.plots?.length || 0,
// plotVariables: plotVariablesData?.variables?.length || 0
// })
} catch (error) {
toast({
title: '❌ Failed to load plot configurations',
@ -495,7 +495,7 @@ export default function PlotManager() {
// Actualizar estado local
setPlotsConfig(updatedConfig)
console.log(`✅ Plot ${plotId} configuration updated locally`)
// console.log(` Plot ${plotId} configuration updated locally`)
} catch (error) {
console.error(`❌ Failed to update plot ${plotId} config:`, error)
throw error
@ -732,7 +732,7 @@ export default function PlotManager() {
onChange={(e) => {
const newPlotId = e.target.value
setSelectedPlotId(newPlotId)
console.log(`🎯 Plot selection changed to: ${newPlotId}`)
// console.log(`🎯 Plot selection changed to: ${newPlotId}`)
}}
placeholder="Choose a plot to configure..."
size="lg"

View File

@ -63,7 +63,7 @@ export function useCoordinatedConnection(source, connectionFactory, dependencies
coordinator.broadcastData(source, newData)
})
setIsConnected(true)
console.log(`👑 Leader connection created for ${source}`)
// console.log(`👑 Leader connection created for ${source}`)
} catch (error) {
console.error(`Error creating leader connection for ${source}:`, error)
setIsConnected(false)
@ -71,7 +71,7 @@ export function useCoordinatedConnection(source, connectionFactory, dependencies
} else {
// Somos seguidores, solo escuchar broadcasts
connectionRef.current = null
console.log(`👥 Follower listening for ${source}`)
// console.log(`👥 Follower listening for ${source}`)
// El estado de conectado se pondrá en true cuando recibamos el primer dato
}
@ -150,13 +150,13 @@ export function useCoordinatedSSE(source, url, dependencies = []) {
useCallback((onData) => {
// Don't create EventSource if URL is null or undefined
if (!url) {
console.log(`Skipping SSE connection - URL is ${url}`)
// console.log(`Skipping SSE connection - URL is ${url}`)
return {
close: () => {} // Return mock connection with close method
}
}
console.log(`Creating SSE connection to ${url}`)
// console.log(`Creating SSE connection to ${url}`)
const eventSource = new EventSource(url)
eventSource.onmessage = (event) => {

View File

@ -918,7 +918,7 @@ function DatasetManager() {
onChange={(e) => {
const newDatasetId = e.target.value
setSelectedDatasetId(newDatasetId)
console.log(`🎯 Dataset selection changed to: ${newDatasetId}`)
// console.log(`🎯 Dataset selection changed to: ${newDatasetId}`)
}}
placeholder="Choose a dataset to configure..."
size="lg"

View File

@ -21,7 +21,7 @@ class TabCoordinator {
this.HEARTBEAT_INTERVAL = 3000 // 3 segundos
this.LEADER_TIMEOUT = 6000 // 6 segundos sin heartbeat = cambio de líder
console.log(`🔗 TabCoordinator initialized for tab ${this.tabId}`)
// console.log(`🔗 TabCoordinator initialized for tab ${this.tabId}`)
this.setupEventListeners()
this.electLeader()
@ -89,7 +89,7 @@ class TabCoordinator {
becomeLeader() {
if (this.isLeader) return
console.log(`👑 Tab ${this.tabId} becoming leader`)
// console.log(`👑 Tab ${this.tabId} becoming leader`)
this.isLeader = true
// Anunciar liderazgo

View File

@ -55,4 +55,4 @@ export default ChartJS;
export { ChartJS };
// Initialize Chart.js setup
console.log('📊 Chart.js setup complete - all plugins registered');
// console.log('📊 Chart.js setup complete - all plugins registered');