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

@@ -1,18 +1,19 @@
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { projectsApi } from '@/lib/api/projects';
import type { Project, CreateProjectDto, UpdateProjectDto } from '@/types/project';
import { logger } from '@/lib/utils/logger';
export function useProjects(page = 1, pageSize = 20) {
return useQuery<Project[]>({
queryKey: ['projects', page, pageSize],
queryFn: async () => {
console.log('[useProjects] Fetching projects...', { page, pageSize });
logger.debug('[useProjects] Fetching projects...', { page, pageSize });
try {
const result = await projectsApi.getAll(page, pageSize);
console.log('[useProjects] Fetch successful:', result);
logger.debug('[useProjects] Fetch successful:', result);
return result;
} catch (error) {
console.error('[useProjects] Fetch failed:', error);
logger.error('[useProjects] Fetch failed:', error);
throw error;
}
},