fix: enhance error logging by replacing console.error with a centralized logger across the application to improve security and maintainability

This commit is contained in:
Usman Baig
2026-02-22 20:57:21 +01:00
parent 837c677b51
commit 2d0307d328
17 changed files with 62 additions and 31 deletions

View File

@@ -1,6 +1,7 @@
'use client'
import { useAuth } from '@/lib/auth/context'
import { logger } from '@/lib/utils/logger'
import { useCallback, useEffect, useState } from 'react'
import { useParams, useRouter } from 'next/navigation'
import { motion } from 'framer-motion'
@@ -85,7 +86,7 @@ export default function SiteDashboardPage() {
if (settings.multiDayInterval) setMultiDayInterval(settings.multiDayInterval)
}
} catch (e) {
console.error('Failed to load dashboard settings', e)
logger.error('Failed to load dashboard settings', e)
} finally {
setIsSettingsLoaded(true)
}
@@ -103,7 +104,7 @@ export default function SiteDashboardPage() {
}
localStorage.setItem('pulse_dashboard_settings', JSON.stringify(settings))
} catch (e) {
console.error('Failed to save dashboard settings', e)
logger.error('Failed to save dashboard settings', e)
}
}

View File

@@ -1,6 +1,7 @@
'use client'
import { useState, useEffect } from 'react'
import { logger } from '@/lib/utils/logger'
import { useRouter } from 'next/navigation'
import Link from 'next/link'
import { createSite, listSites, getSite, type Site } from '@/lib/api/sites'
@@ -65,7 +66,7 @@ export default function NewSitePage() {
router.replace('/')
}
} catch (error) {
console.error('Failed to check limits', error)
logger.error('Failed to check limits', error)
} finally {
setLimitsChecked(true)
}