-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Code QualityCodebase needs improvementCodebase needs improvementgood first issueGood for newcomersGood for newcomers
Description
Description
Current State
The codebase has ~430 console.log/console.error statements scattered throughout, despite having a proper logging system implemented in lib/debug-logger.ts. This was expedient during rapid development but makes production debugging difficult since there's no way to control log levels.
Examples found
// app/admin/superadmin-setup/page.tsx:93
console.error('Error assigning superadmin role:', error)
// components/navigation.tsx:381
console.log('🔍 DEBUG: Rendering visibleItems:', visibleItems.map((i: any) => i.name));
// app/api/debug-stakeholders/route.ts:35-40
console.log('=== STAKEHOLDERS DEBUG ===')
console.log('Project ID:', projectId)Desired Outcome
Replace with the existing logger:
import { logger } from '@/lib/debug-logger';
logger.debug('User does not have permission', { userId, permission });
logger.error('Database operation failed', { action: 'create_project' }, error as Error);How to get started
- Run
grep -rn "console\.\(log\|error\|warn\)" --include="*.ts" --include="*.tsx" app/ components/ lib/to find all instances - Start with API routes in
app/api/as they're simpler - Leave
lib/debug-logger.tsalone (it's the implementation) - Test by running
npm run devand verifying logs still appear
Acceptance Criteria
- Zero
console.logoutside oflib/debug-logger.ts - All logs use appropriate level (debug, info, warn, error)
- Include context objects where helpful
Metadata
Metadata
Assignees
Labels
Code QualityCodebase needs improvementCodebase needs improvementgood first issueGood for newcomersGood for newcomers