From 09907dbd8b02106bde6785798b1dbdab27e5f79d Mon Sep 17 00:00:00 2001 From: S <1287773673@qq.com> Date: Mon, 8 Dec 2025 10:20:22 +0800 Subject: [PATCH 1/9] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=8F=B0=E6=97=A5=E5=BF=97=E9=80=92=E5=BD=92=E7=88=86=E7=82=B8?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 pauseLogging 标志,在 GetLogs/GetRecentLogs/ClearLogs 执行期间暂停日志捕获 - 添加日志过滤规则,过滤 Wails 框架内部日志和 JSON 序列化日志 - 解决打开控制台界面时日志无限递归导致控制台输出大量转义字符的问题 --- services/consoleservice.go | 75 +++++++++++++++++++++++++++++++++++--- 1 file changed, 69 insertions(+), 6 deletions(-) diff --git a/services/consoleservice.go b/services/consoleservice.go index 830dda7..c73f002 100644 --- a/services/consoleservice.go +++ b/services/consoleservice.go @@ -5,6 +5,7 @@ import ( "io" "log" "os" + "strings" "sync" "time" ) @@ -18,12 +19,13 @@ type ConsoleLog struct { // ConsoleService 控制台日志服务 type ConsoleService struct { - logs []ConsoleLog - mutex sync.RWMutex - maxLogs int - writer *consoleWriter - oldStdout *os.File - oldStderr *os.File + logs []ConsoleLog + mutex sync.RWMutex + maxLogs int + writer *consoleWriter + oldStdout *os.File + oldStderr *os.File + pauseLogging bool // 暂停日志捕获标志 } // consoleWriter 自定义 writer,同时写入控制台和缓存 @@ -99,6 +101,16 @@ func (cs *ConsoleService) readPipe(reader *os.File, level string, output *os.Fil // addLog 添加日志到缓存 func (cs *ConsoleService) addLog(level, message string) { + // 如果暂停日志捕获,直接返回 + if cs.pauseLogging { + return + } + + // 过滤 Wails 框架的调试日志,避免日志递归 + if shouldFilterLog(message) { + return + } + cs.mutex.Lock() defer cs.mutex.Unlock() @@ -142,6 +154,10 @@ func (cs *ConsoleService) cleanOldLogs() { // GetLogs 获取所有日志 func (cs *ConsoleService) GetLogs() []ConsoleLog { + // 暂停日志捕获,避免 GetLogs 本身产生的日志被记录(导致递归) + cs.pauseLogging = true + defer func() { cs.pauseLogging = false }() + cs.mutex.RLock() defer cs.mutex.RUnlock() @@ -153,6 +169,10 @@ func (cs *ConsoleService) GetLogs() []ConsoleLog { // GetRecentLogs 获取最近 N 条日志 func (cs *ConsoleService) GetRecentLogs(count int) []ConsoleLog { + // 暂停日志捕获,避免递归 + cs.pauseLogging = true + defer func() { cs.pauseLogging = false }() + cs.mutex.RLock() defer cs.mutex.RUnlock() @@ -172,8 +192,51 @@ func (cs *ConsoleService) GetRecentLogs(count int) []ConsoleLog { // ClearLogs 清空日志 func (cs *ConsoleService) ClearLogs() { + // 暂停日志捕获,避免递归 + cs.pauseLogging = true + defer func() { cs.pauseLogging = false }() + cs.mutex.Lock() defer cs.mutex.Unlock() cs.logs = make([]ConsoleLog, 0, 1000) } + +// shouldFilterLog 判断是否应该过滤这条日志 +// 过滤掉 Wails 框架的调试日志和 JSON 序列化日志,避免日志递归爆炸 +func shouldFilterLog(message string) bool { + // 1. 过滤掉包含大量反斜杠的日志(JSON 序列化递归) + // 正常日志不应该有超过 10 个连续的反斜杠 + if strings.Contains(message, "\\\\\\\\\\\\\\\\\\\\") { + return true + } + + // 2. 过滤掉包含 JSON 结构的日志(GetLogs 的返回值被序列化) + // 检测是否包含日志的 JSON 结构特征 + if strings.Contains(message, `"timestamp":`) && + strings.Contains(message, `"level":`) && + strings.Contains(message, `"message":`) { + return true + } + + // 3. 过滤 Wails 框架的内部日志 + filterKeywords := []string{ + "Binding call started", + "Binding call complete", + "Asset Request", + "INF Binding call", + "INF Asset Request", + "/wails/runtime", + "ConsoleService.GetLogs", + "ConsoleService.GetRecentLogs", + "ConsoleService.ClearLogs", + } + + for _, keyword := range filterKeywords { + if strings.Contains(message, keyword) { + return true + } + } + + return false +} From cc32385620b14f37430a3ed8ec16deeb87c6cb9a Mon Sep 17 00:00:00 2001 From: S <1287773673@qq.com> Date: Wed, 21 Jan 2026 10:34:23 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=20=20=E2=9C=A8=20feat(heatmap):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=87=AA=E9=80=82=E5=BA=94=E7=83=AD=E5=8A=9B?= =?UTF-8?q?=E5=9B=BE=E5=92=8C=E5=9B=BE=E6=A0=87=E6=90=9C=E7=B4=A2=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 实现热力图自适应容器宽度,并为图标选择添加搜索功能 主要变更: - 新增 useAdaptiveHeatmap composable,封装热力图自适应逻辑 - 热力图根据容器宽度动态计算显示列数,移除横向滚动条 - 使用 ResizeObserver 监听容器尺寸变化,采用节流优化性能 - 图标选择下拉框添加搜索筛选功能,支持实时过滤 - 为供应商卡片的编辑和删除按钮添加 tooltip 提示 - 修复图标选择器和等级选择器的按钮样式问题 --- frontend/src/components/Main/Index.vue | 69 +++--- .../src/composables/useAdaptiveHeatmap.ts | 208 ++++++++++++++++++ frontend/src/data/usageHeatmap.ts | 2 +- frontend/src/locales/en.json | 4 +- frontend/src/locales/zh.json | 4 +- frontend/src/style.css | 81 ++++--- 6 files changed, 302 insertions(+), 66 deletions(-) create mode 100644 frontend/src/composables/useAdaptiveHeatmap.ts diff --git a/frontend/src/components/Main/Index.vue b/frontend/src/components/Main/Index.vue index a52abeb..8014ae1 100644 --- a/frontend/src/components/Main/Index.vue +++ b/frontend/src/components/Main/Index.vue @@ -498,7 +498,7 @@ class="ghost-icon direct-apply-btn" :class="{ 'is-active': isDirectApplied(card) && !activeProxyState }" :disabled="activeProxyState" - :title="activeProxyState ? t('components.main.directApply.proxyEnabled') : (isDirectApplied(card) ? t('components.main.directApply.inUse') : t('components.main.directApply.title'))" + :data-tooltip="activeProxyState ? t('components.main.directApply.proxyEnabled') : (isDirectApplied(card) ? t('components.main.directApply.inUse') : t('components.main.directApply.title'))" @click.stop="!isDirectApplied(card) && handleDirectApply(card)" > {{ t('components.main.directApply.inUse') }} @@ -506,7 +506,7 @@ - -