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:
@@ -3,6 +3,9 @@
|
||||
* Manages the code quality dashboard page
|
||||
*/
|
||||
|
||||
// ✅ Use centralized logger
|
||||
const codeQualityLog = window.LogConfig.createLogger('CODE-QUALITY');
|
||||
|
||||
function codeQualityDashboard() {
|
||||
return {
|
||||
// Extend base data
|
||||
@@ -45,7 +48,7 @@ function codeQualityDashboard() {
|
||||
const stats = await apiClient.get('/admin/code-quality/stats');
|
||||
this.stats = stats;
|
||||
} catch (err) {
|
||||
console.error('Failed to load stats:', err);
|
||||
codeQualityLog.error('Failed to load stats:', err);
|
||||
this.error = err.message;
|
||||
|
||||
// Redirect to login if unauthorized
|
||||
@@ -74,7 +77,7 @@ function codeQualityDashboard() {
|
||||
this.successMessage = null;
|
||||
}, 5000);
|
||||
} catch (err) {
|
||||
console.error('Failed to run scan:', err);
|
||||
codeQualityLog.error('Failed to run scan:', err);
|
||||
this.error = err.message;
|
||||
|
||||
// Redirect to login if unauthorized
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
* Manages the violations list page with filtering and pagination
|
||||
*/
|
||||
|
||||
// ✅ Use centralized logger
|
||||
const codeQualityViolationsLog = window.LogConfig.createLogger('CODE-QUALITY');
|
||||
|
||||
function codeQualityViolations() {
|
||||
return {
|
||||
// Extend base data
|
||||
@@ -68,7 +71,7 @@ function codeQualityViolations() {
|
||||
// Update URL with current filters (without reloading)
|
||||
this.updateURL();
|
||||
} catch (err) {
|
||||
console.error('Failed to load violations:', err);
|
||||
codeQualityViolationsLog.error('Failed to load violations:', err);
|
||||
this.error = err.message;
|
||||
|
||||
// Redirect to login if unauthorized
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
// ✅ Use centralized logger
|
||||
const adminImportsLog = window.LogConfig.loggers.imports;
|
||||
|
||||
console.log('[ADMIN IMPORTS] Loading...');
|
||||
adminImportsLog.info('Loading...');
|
||||
|
||||
function adminImports() {
|
||||
console.log('[ADMIN IMPORTS] adminImports() called');
|
||||
adminImportsLog.debug('adminImports() called');
|
||||
|
||||
return {
|
||||
// ✅ Inherit base layout state
|
||||
@@ -82,9 +82,9 @@ function adminImports() {
|
||||
try {
|
||||
const response = await apiClient.get('/admin/vendors?limit=1000');
|
||||
this.vendors = response.vendors || [];
|
||||
console.log('[ADMIN IMPORTS] Loaded vendors:', this.vendors.length);
|
||||
adminImportsLog.debug('Loaded vendors:', this.vendors.length);
|
||||
} 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,
|
||||
failed: response.failed || 0
|
||||
};
|
||||
console.log('[ADMIN IMPORTS] Loaded stats:', this.stats);
|
||||
adminImportsLog.debug('Loaded stats:', this.stats);
|
||||
} catch (error) {
|
||||
console.error('[ADMIN IMPORTS] Failed to load stats:', error);
|
||||
adminImportsLog.error('Failed to load stats:', error);
|
||||
// Non-critical, don't show error
|
||||
}
|
||||
},
|
||||
@@ -142,9 +142,9 @@ function adminImports() {
|
||||
this.jobs = response.items || [];
|
||||
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) {
|
||||
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';
|
||||
} finally {
|
||||
this.loading = false;
|
||||
@@ -199,9 +199,9 @@ function adminImports() {
|
||||
this.selectedJob = response;
|
||||
}
|
||||
|
||||
console.log('[ADMIN IMPORTS] Refreshed job:', jobId);
|
||||
adminImportsLog.debug('Refreshed job:', jobId);
|
||||
} 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}`);
|
||||
this.selectedJob = response;
|
||||
this.showJobModal = true;
|
||||
console.log('[ADMIN IMPORTS] Viewing job details:', jobId);
|
||||
adminImportsLog.debug('Viewing job details:', jobId);
|
||||
} 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';
|
||||
}
|
||||
},
|
||||
@@ -318,7 +318,7 @@ function adminImports() {
|
||||
);
|
||||
|
||||
if (hasActiveJobs) {
|
||||
console.log('[ADMIN IMPORTS] Auto-refreshing active jobs...');
|
||||
adminImportsLog.debug('Auto-refreshing active jobs...');
|
||||
await this.loadJobs();
|
||||
await this.loadStats();
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ function adminSettings() {
|
||||
settingsLog.info('=== SETTINGS PAGE INITIALIZING ===');
|
||||
await this.loadLogSettings();
|
||||
} catch (error) {
|
||||
console.error('[Settings] Init failed:', error);
|
||||
settingsLog.error('Init failed:', error);
|
||||
this.error = 'Failed to initialize settings page';
|
||||
}
|
||||
},
|
||||
|
||||
@@ -3,10 +3,13 @@
|
||||
* 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() {
|
||||
console.log('[ADMIN VENDOR THEMES] adminVendorThemes() called');
|
||||
vendorThemesLog.debug('adminVendorThemes() called');
|
||||
|
||||
return {
|
||||
// Inherit base layout state
|
||||
@@ -44,9 +47,9 @@ function adminVendorThemes() {
|
||||
try {
|
||||
const response = await apiClient.get('/admin/vendors?limit=1000');
|
||||
this.vendors = response.vendors || [];
|
||||
console.log('[ADMIN VENDOR THEMES] Loaded vendors:', this.vendors.length);
|
||||
vendorThemesLog.debug('Loaded vendors:', this.vendors.length);
|
||||
} 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';
|
||||
} finally {
|
||||
this.loading = false;
|
||||
@@ -62,4 +65,4 @@ function adminVendorThemes() {
|
||||
};
|
||||
}
|
||||
|
||||
console.log('[ADMIN VENDOR THEMES] Module loaded');
|
||||
vendorThemesLog.info('Module loaded');
|
||||
|
||||
Reference in New Issue
Block a user