frontend: gate routine console.log behind window.DASHCADDY_DEBUG

Suppress noisy module-load and initialization logs in production.
Logs still appear when window.DASHCADDY_DEBUG is set (e.g. during dev).
This commit is contained in:
Krystie
2026-05-14 00:13:50 -07:00
parent f65af5d7fd
commit 8ecae81703
2 changed files with 26 additions and 16 deletions
+18 -12
View File
@@ -9,6 +9,12 @@
(function() {
'use strict';
const debug = (...args) => {
if (window.DASHCADDY_DEBUG) {
console.log(...args);
}
};
let progressTracker;
let themeAdapter;
let tourManager;
@@ -20,7 +26,7 @@
*/
async function initializeOnboarding() {
try {
console.log('[Onboarding] Initializing system...');
debug('[Onboarding] Initializing system...');
if (window.__dashcaddySiteConfigLoaded) {
try {
@@ -30,27 +36,27 @@
// Initialize Error Handler first
errorHandler = new ErrorHandler();
console.log('[Onboarding] Error Handler initialized');
debug('[Onboarding] Error Handler initialized');
// Initialize Progress Tracker
progressTracker = new ProgressTracker('dashcaddy_onboarding');
console.log('[Onboarding] Progress Tracker initialized');
debug('[Onboarding] Progress Tracker initialized');
// Initialize Theme Adapter
themeAdapter = new ThemeAdapter();
console.log('[Onboarding] Theme Adapter initialized');
debug('[Onboarding] Theme Adapter initialized');
// Initialize DNS Template Selector
dnsTemplateSelector = new DnsTemplateSelector(progressTracker);
console.log('[Onboarding] DNS Template Selector initialized');
debug('[Onboarding] DNS Template Selector initialized');
// Initialize Tour Manager
tourManager = new TourManager(progressTracker, themeAdapter, dnsTemplateSelector);
console.log('[Onboarding] Tour Manager initialized');
debug('[Onboarding] Tour Manager initialized');
// Check if tour should auto-start
if (tourManager.shouldAutoStart()) {
console.log('[Onboarding] Auto-starting tour for first-time install');
debug('[Onboarding] Auto-starting tour for first-time install');
await progressTracker.markInstallOnboardingCompleted();
// Wait a bit for page to fully load
setTimeout(() => {
@@ -59,11 +65,11 @@
} else {
const tourCompleted = progressTracker.isTourCompleted();
const currentStep = progressTracker.getCurrentStep();
console.log(`[Onboarding] Tour not auto-starting (completed: ${tourCompleted}, step: ${currentStep})`);
debug(`[Onboarding] Tour not auto-starting (completed: ${tourCompleted}, step: ${currentStep})`);
// If tour is in progress, offer to resume
if (!tourCompleted && currentStep > 0) {
console.log('[Onboarding] Tour in progress, can be resumed manually');
debug('[Onboarding] Tour in progress, can be resumed manually');
}
}
@@ -81,7 +87,7 @@
getErrorStats: () => errorHandler.getStatistics()
};
console.log('[Onboarding] System initialized successfully');
debug('[Onboarding] System initialized successfully');
} catch (error) {
console.error('[Onboarding] Initialization error:', error);
@@ -104,7 +110,7 @@
const clickHandler = () => {
if (tourManager) {
console.log('[Onboarding] Starting tour via button click');
debug('[Onboarding] Starting tour via button click');
tourManager.restartTour();
} else {
console.error('[Onboarding] Tour manager not initialized');
@@ -179,6 +185,6 @@
waitForDriver();
}
console.log('[Onboarding] System loaded');
debug('[Onboarding] System loaded');
})();