fix(js): replace console.log with centralized logger (JS-002)

Convert direct console.log/error/warn calls to use centralized logger:
- imports.js: 13 violations fixed using adminImportsLog
- vendor-themes.js: 5 violations fixed using vendorThemesLog
- code-quality-dashboard.js: 2 violations fixed using codeQualityLog
- code-quality-violations.js: 1 violation fixed using codeQualityViolationsLog
- settings.js: 1 violation fixed using settingsLog

All files now use window.LogConfig.loggers.* for consistent logging.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-03 21:31:48 +01:00
parent 96bdb07fb2
commit dd0ba1ed5e
5 changed files with 31 additions and 22 deletions

View File

@@ -3,6 +3,9 @@
* Manages the code quality dashboard page * Manages the code quality dashboard page
*/ */
// ✅ Use centralized logger
const codeQualityLog = window.LogConfig.createLogger('CODE-QUALITY');
function codeQualityDashboard() { function codeQualityDashboard() {
return { return {
// Extend base data // Extend base data
@@ -45,7 +48,7 @@ function codeQualityDashboard() {
const stats = await apiClient.get('/admin/code-quality/stats'); const stats = await apiClient.get('/admin/code-quality/stats');
this.stats = stats; this.stats = stats;
} catch (err) { } catch (err) {
console.error('Failed to load stats:', err); codeQualityLog.error('Failed to load stats:', err);
this.error = err.message; this.error = err.message;
// Redirect to login if unauthorized // Redirect to login if unauthorized
@@ -74,7 +77,7 @@ function codeQualityDashboard() {
this.successMessage = null; this.successMessage = null;
}, 5000); }, 5000);
} catch (err) { } catch (err) {
console.error('Failed to run scan:', err); codeQualityLog.error('Failed to run scan:', err);
this.error = err.message; this.error = err.message;
// Redirect to login if unauthorized // Redirect to login if unauthorized

View File

@@ -3,6 +3,9 @@
* Manages the violations list page with filtering and pagination * Manages the violations list page with filtering and pagination
*/ */
// ✅ Use centralized logger
const codeQualityViolationsLog = window.LogConfig.createLogger('CODE-QUALITY');
function codeQualityViolations() { function codeQualityViolations() {
return { return {
// Extend base data // Extend base data
@@ -68,7 +71,7 @@ function codeQualityViolations() {
// Update URL with current filters (without reloading) // Update URL with current filters (without reloading)
this.updateURL(); this.updateURL();
} catch (err) { } catch (err) {
console.error('Failed to load violations:', err); codeQualityViolationsLog.error('Failed to load violations:', err);
this.error = err.message; this.error = err.message;
// Redirect to login if unauthorized // Redirect to login if unauthorized

View File

@@ -6,10 +6,10 @@
// ✅ Use centralized logger // ✅ Use centralized logger
const adminImportsLog = window.LogConfig.loggers.imports; const adminImportsLog = window.LogConfig.loggers.imports;
console.log('[ADMIN IMPORTS] Loading...'); adminImportsLog.info('Loading...');
function adminImports() { function adminImports() {
console.log('[ADMIN IMPORTS] adminImports() called'); adminImportsLog.debug('adminImports() called');
return { return {
// ✅ Inherit base layout state // ✅ Inherit base layout state
@@ -82,9 +82,9 @@ function adminImports() {
try { try {
const response = await apiClient.get('/admin/vendors?limit=1000'); const response = await apiClient.get('/admin/vendors?limit=1000');
this.vendors = response.vendors || []; this.vendors = response.vendors || [];
console.log('[ADMIN IMPORTS] Loaded vendors:', this.vendors.length); adminImportsLog.debug('Loaded vendors:', this.vendors.length);
} catch (error) { } catch (error) {
console.error('[ADMIN IMPORTS] Failed to load vendors:', error); adminImportsLog.error('Failed to load vendors:', error);
} }
}, },
@@ -100,9 +100,9 @@ function adminImports() {
completed: response.completed || 0, completed: response.completed || 0,
failed: response.failed || 0 failed: response.failed || 0
}; };
console.log('[ADMIN IMPORTS] Loaded stats:', this.stats); adminImportsLog.debug('Loaded stats:', this.stats);
} catch (error) { } catch (error) {
console.error('[ADMIN IMPORTS] Failed to load stats:', error); adminImportsLog.error('Failed to load stats:', error);
// Non-critical, don't show error // Non-critical, don't show error
} }
}, },
@@ -142,9 +142,9 @@ function adminImports() {
this.jobs = response.items || []; this.jobs = response.items || [];
this.totalJobs = response.total || 0; this.totalJobs = response.total || 0;
console.log('[ADMIN IMPORTS] Loaded all jobs:', this.jobs.length); adminImportsLog.debug('Loaded all jobs:', this.jobs.length);
} catch (error) { } catch (error) {
console.error('[ADMIN IMPORTS] Failed to load jobs:', error); adminImportsLog.error('Failed to load jobs:', error);
this.error = error.message || 'Failed to load import jobs'; this.error = error.message || 'Failed to load import jobs';
} finally { } finally {
this.loading = false; this.loading = false;
@@ -199,9 +199,9 @@ function adminImports() {
this.selectedJob = response; this.selectedJob = response;
} }
console.log('[ADMIN IMPORTS] Refreshed job:', jobId); adminImportsLog.debug('Refreshed job:', jobId);
} catch (error) { } catch (error) {
console.error('[ADMIN IMPORTS] Failed to refresh job:', error); adminImportsLog.error('Failed to refresh job:', error);
} }
}, },
@@ -213,9 +213,9 @@ function adminImports() {
const response = await apiClient.get(`/admin/marketplace-import-jobs/${jobId}`); const response = await apiClient.get(`/admin/marketplace-import-jobs/${jobId}`);
this.selectedJob = response; this.selectedJob = response;
this.showJobModal = true; this.showJobModal = true;
console.log('[ADMIN IMPORTS] Viewing job details:', jobId); adminImportsLog.debug('Viewing job details:', jobId);
} catch (error) { } catch (error) {
console.error('[ADMIN IMPORTS] Failed to load job details:', error); adminImportsLog.error('Failed to load job details:', error);
this.error = error.message || 'Failed to load job details'; this.error = error.message || 'Failed to load job details';
} }
}, },
@@ -318,7 +318,7 @@ function adminImports() {
); );
if (hasActiveJobs) { if (hasActiveJobs) {
console.log('[ADMIN IMPORTS] Auto-refreshing active jobs...'); adminImportsLog.debug('Auto-refreshing active jobs...');
await this.loadJobs(); await this.loadJobs();
await this.loadStats(); await this.loadStats();
} }

View File

@@ -31,7 +31,7 @@ function adminSettings() {
settingsLog.info('=== SETTINGS PAGE INITIALIZING ==='); settingsLog.info('=== SETTINGS PAGE INITIALIZING ===');
await this.loadLogSettings(); await this.loadLogSettings();
} catch (error) { } catch (error) {
console.error('[Settings] Init failed:', error); settingsLog.error('Init failed:', error);
this.error = 'Failed to initialize settings page'; this.error = 'Failed to initialize settings page';
} }
}, },

View File

@@ -3,10 +3,13 @@
* Admin vendor themes selection page * Admin vendor themes selection page
*/ */
console.log('[ADMIN VENDOR THEMES] Loading...'); // ✅ Use centralized logger
const vendorThemesLog = window.LogConfig.loggers.vendorTheme;
vendorThemesLog.info('Loading...');
function adminVendorThemes() { function adminVendorThemes() {
console.log('[ADMIN VENDOR THEMES] adminVendorThemes() called'); vendorThemesLog.debug('adminVendorThemes() called');
return { return {
// Inherit base layout state // Inherit base layout state
@@ -44,9 +47,9 @@ function adminVendorThemes() {
try { try {
const response = await apiClient.get('/admin/vendors?limit=1000'); const response = await apiClient.get('/admin/vendors?limit=1000');
this.vendors = response.vendors || []; this.vendors = response.vendors || [];
console.log('[ADMIN VENDOR THEMES] Loaded vendors:', this.vendors.length); vendorThemesLog.debug('Loaded vendors:', this.vendors.length);
} catch (error) { } catch (error) {
console.error('[ADMIN VENDOR THEMES] Failed to load vendors:', error); vendorThemesLog.error('Failed to load vendors:', error);
this.error = error.message || 'Failed to load vendors'; this.error = error.message || 'Failed to load vendors';
} finally { } finally {
this.loading = false; this.loading = false;
@@ -62,4 +65,4 @@ function adminVendorThemes() {
}; };
} }
console.log('[ADMIN VENDOR THEMES] Module loaded'); vendorThemesLog.info('Module loaded');