feat: standardize logging across UI components

- Replaced console.log and console.error statements with logger methods from @automaker/utils in various UI components, ensuring consistent log formatting and improved readability.
- Enhanced error handling by utilizing logger methods to provide clearer context for issues encountered during operations.
- Updated multiple views and hooks to integrate the new logging system, improving maintainability and debugging capabilities.

This update significantly enhances the observability of UI components, facilitating easier troubleshooting and monitoring.
This commit is contained in:
Shirone
2026-01-02 17:25:13 +01:00
parent 96a999817f
commit 69f3ba9724
86 changed files with 1079 additions and 677 deletions

View File

@@ -1,5 +1,8 @@
import { useState, useEffect, useCallback } from 'react';
import { createLogger } from '@automaker/utils/logger';
import { useSetupStore } from '@/store/setup-store';
const logger = createLogger('CliStatus');
import { getElectronAPI } from '@/lib/electron';
interface CliStatusResult {
@@ -40,7 +43,7 @@ export function useCliStatus() {
const status = await api.checkClaudeCli();
setClaudeCliStatus(status);
} catch (error) {
console.error('Failed to check Claude CLI status:', error);
logger.error('Failed to check Claude CLI status:', error);
}
}
@@ -84,7 +87,7 @@ export function useCliStatus() {
setClaudeAuthStatus(authStatus);
}
} catch (error) {
console.error('Failed to check Claude auth status:', error);
logger.error('Failed to check Claude auth status:', error);
}
}
};
@@ -102,7 +105,7 @@ export function useCliStatus() {
setClaudeCliStatus(status);
}
} catch (error) {
console.error('Failed to refresh Claude CLI status:', error);
logger.error('Failed to refresh Claude CLI status:', error);
} finally {
setIsCheckingClaudeCli(false);
}

View File

@@ -1,5 +1,8 @@
import { useState, useCallback } from 'react';
import { createLogger } from '@automaker/utils/logger';
import { toast } from 'sonner';
const logger = createLogger('CursorPermissions');
import { getHttpApiClient } from '@/lib/http-api-client';
import type { CursorPermissionProfile } from '@automaker/types';
@@ -41,7 +44,7 @@ export function useCursorPermissions(projectPath?: string) {
});
}
} catch (error) {
console.error('Failed to load Cursor permissions:', error);
logger.error('Failed to load Cursor permissions:', error);
} finally {
setIsLoadingPermissions(false);
}

View File

@@ -1,5 +1,8 @@
import { useState, useEffect, useCallback } from 'react';
import { createLogger } from '@automaker/utils/logger';
import { toast } from 'sonner';
const logger = createLogger('CursorStatus');
import { getHttpApiClient } from '@/lib/http-api-client';
import { useSetupStore } from '@/store/setup-store';
@@ -48,7 +51,7 @@ export function useCursorStatus() {
});
}
} catch (error) {
console.error('Failed to load Cursor settings:', error);
logger.error('Failed to load Cursor settings:', error);
toast.error('Failed to load Cursor settings');
} finally {
setIsLoading(false);