Files
MyGoNavi/internal/logger/wails_adapter_test.go
Syngnat 3ea3223749 🐛 fix(query-editor/logging): 修复达梦SQL美化并完善诊断日志
- 为达梦和自定义 DM8 连接启用 SQL 格式化位置占位符
- 记录 SQL 美化方言、作用域、耗时及脱敏错误信息
- 将 Wails 前端日志接入 GoNavi 应用日志文件
- 启动时输出应用版本及实际驱动模块和代理版本
- 补充达梦占位符、日志落盘与启动诊断回归测试
2026-07-30 18:17:08 +08:00

29 lines
731 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package logger
import (
"strings"
"testing"
"time"
)
func TestWailsAdapterWritesFrontendLogsToApplicationLog(t *testing.T) {
sink := &slowSyncSink{}
installTestSink(t, sink, time.Hour)
adapter := NewWailsAdapter()
adapter.Info("[SQL美化] 成功language=plsql")
adapter.Warning("frontend warning")
adapter.Error("[SQL美化] 失败error=Parse error")
contents, _, _, _ := sink.snapshot()
for _, expected := range []string{
"[INFO] [Wails] [SQL美化] 成功language=plsql",
"[WARN] [Wails] frontend warning",
"[ERROR] [Wails] [SQL美化] 失败error=Parse error",
} {
if !strings.Contains(contents, expected) {
t.Fatalf("application log %q does not contain %q", contents, expected)
}
}
}