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:
@@ -14,6 +14,9 @@
|
||||
import { useEffect, useRef, useCallback } from 'react';
|
||||
import { useChatStore } from '../store/chatStore';
|
||||
import { intelligenceClient, type IdentityChangeProposal } from './intelligence-client';
|
||||
import { createLogger } from './logger';
|
||||
|
||||
const log = createLogger('ProposalNotifications');
|
||||
|
||||
// Configuration
|
||||
const POLL_INTERVAL_MS = 60_000; // 1 minute
|
||||
@@ -109,7 +112,7 @@ export function useProposalNotifications(): {
|
||||
saveNotifiedProposals(notifiedProposalsRef.current);
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('[ProposalNotifications] Failed to check proposals:', err);
|
||||
log.warn('Failed to check proposals:', err);
|
||||
} finally {
|
||||
isPollingRef.current = false;
|
||||
}
|
||||
@@ -164,7 +167,7 @@ export function ProposalNotificationHandler(): null {
|
||||
const { count } = customEvent.detail;
|
||||
|
||||
// You can integrate with a toast system here
|
||||
console.log(`[ProposalNotifications] ${count} new proposal(s) available`);
|
||||
log.debug(`${count} new proposal(s) available`);
|
||||
|
||||
// If using the Toast system from Toast.tsx, you would do:
|
||||
// toast(`${count} 个新的人格变更提案待审批`, 'info');
|
||||
|
||||
Reference in New Issue
Block a user