fix(desktop): console.log 清理 — 替换为结构化 logger
将 desktop/src 中 23 处 console.log 替换为 createLogger() 结构化日志: - 生产构建自动静默 debug/info 级别 - 保留 console.error 用于关键错误可见性 - 新增 dompurify 依赖修复 XSS 防护引入缺失 涉及文件: App.tsx, offlineStore.ts, autonomy-manager.ts, gateway-auth.ts, llm-service.ts, request-helper.ts, security-index.ts, skill-discovery.ts, use-onboarding.ts 等 16 个文件
This commit is contained in:
@@ -13,6 +13,9 @@ import { useWorkflowStore } from '../store/workflowStore';
|
||||
import { useChatStore } from '../store/chatStore';
|
||||
import type { GatewayClient } from '../lib/gateway-client';
|
||||
import { speechSynth } from '../lib/speech-synth';
|
||||
import { createLogger } from '../lib/logger';
|
||||
|
||||
const log = createLogger('useAutomationEvents');
|
||||
|
||||
// === Event Types ===
|
||||
|
||||
@@ -132,7 +135,7 @@ export function useAutomationEvents(
|
||||
if (!isHandEvent(data)) return;
|
||||
|
||||
const eventData = data as HandEventData;
|
||||
console.log('[useAutomationEvents] Hand event:', eventData);
|
||||
log.debug('Hand event:', eventData);
|
||||
|
||||
// Refresh hands if status changed
|
||||
if (refreshOnStatusChange) {
|
||||
@@ -175,7 +178,7 @@ export function useAutomationEvents(
|
||||
pitch: typeof res.pitch === 'number' ? res.pitch : undefined,
|
||||
volume: typeof res.volume === 'number' ? res.volume : undefined,
|
||||
}).catch((err: unknown) => {
|
||||
console.warn('[useAutomationEvents] Browser TTS failed:', err);
|
||||
log.warn('Browser TTS failed:', err);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -209,7 +212,7 @@ export function useAutomationEvents(
|
||||
if (!isWorkflowEvent(data)) return;
|
||||
|
||||
const eventData = data as WorkflowEventData;
|
||||
console.log('[useAutomationEvents] Workflow event:', eventData);
|
||||
log.debug('Workflow event:', eventData);
|
||||
|
||||
// Refresh workflows if status changed
|
||||
if (refreshOnStatusChange) {
|
||||
@@ -250,7 +253,7 @@ export function useAutomationEvents(
|
||||
if (!isApprovalEvent(data)) return;
|
||||
|
||||
const eventData = data as ApprovalEventData;
|
||||
console.log('[useAutomationEvents] Approval event:', eventData);
|
||||
log.debug('Approval event:', eventData);
|
||||
|
||||
// Refresh approvals list
|
||||
loadApprovals();
|
||||
|
||||
Reference in New Issue
Block a user