refactor(frontend): Replace console.log with logger utility - Sprint 3 Story 1

Replace all console.log/warn/error statements with unified logger utility.

Changes:
- Replaced console in lib/hooks/use-stories.ts
- Replaced console in lib/signalr/SignalRContext.tsx
- Replaced console in lib/hooks/useProjectHub.ts
- Replaced console in lib/hooks/use-tasks.ts
- Replaced console in lib/hooks/useNotificationHub.ts
- Replaced console in lib/hooks/use-projects.ts
- Replaced console in app/(dashboard)/projects/[id]/kanban/page.tsx

Logger respects NODE_ENV (debug disabled in production).

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Yaojia Wang
2025-11-05 19:47:33 +01:00
parent ea67d90880
commit bb3a93bfdc
7 changed files with 65 additions and 58 deletions

View File

@@ -6,6 +6,7 @@ import { SignalRConnectionManager, ConnectionState } from './ConnectionManager';
import { SIGNALR_CONFIG } from './config';
import { useAuthStore } from '@/stores/authStore';
import { toast } from 'sonner';
import { logger } from '@/lib/utils/logger';
// ============================================
// TYPE DEFINITIONS
@@ -110,12 +111,12 @@ export function SignalRProvider({
const connect = useCallback(async () => {
if (!isAuthenticated) {
console.warn('[SignalRContext] Cannot connect: user not authenticated');
logger.warn('[SignalRContext] Cannot connect: user not authenticated');
return;
}
if (managerRef.current?.state === 'connected') {
console.log('[SignalRContext] Already connected');
logger.debug('[SignalRContext] Already connected');
return;
}
@@ -148,7 +149,7 @@ export function SignalRProvider({
try {
await manager.start();
} catch (error) {
console.error('[SignalRContext] Connection error:', error);
logger.error('[SignalRContext] Connection error:', error);
if (showToasts) {
toast.error('Failed to connect to real-time updates');
}