From ecabffc8900e12d7f8a23f83547fe35ffe2c8e96 Mon Sep 17 00:00:00 2001 From: jim800121chen Date: Mon, 9 Mar 2026 18:35:57 +0800 Subject: [PATCH] feat: write installation log to temp directory Installer now writes a detailed log to %TEMP%/edgeai-install.log (or /tmp/edgeai-install.log on macOS/Linux) with OK/FAIL status for each step. Log path is shown on completion and in error messages. Co-Authored-By: Claude Opus 4.6 --- edge-ai-platform/installer/app.go | 32 +++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/edge-ai-platform/installer/app.go b/edge-ai-platform/installer/app.go index cb60e2a..290ae09 100644 --- a/edge-ai-platform/installer/app.go +++ b/edge-ai-platform/installer/app.go @@ -13,6 +13,7 @@ import ( "path/filepath" "runtime" "strings" + "time" wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime" ) @@ -199,6 +200,25 @@ func (inst *Installer) StartInstall(config InstallConfig) error { } func (inst *Installer) runInstall(config InstallConfig) { + // Create install log file + logPath := filepath.Join(os.TempDir(), "edgeai-install.log") + logFile, _ := os.Create(logPath) + if logFile != nil { + defer logFile.Close() + } + logMsg := func(format string, args ...interface{}) { + msg := fmt.Sprintf(format, args...) + if logFile != nil { + fmt.Fprintln(logFile, msg) + } + } + + logMsg("=== Edge AI Platform Installation Log ===") + logMsg("Time: %s", time.Now().Format(time.RFC3339)) + logMsg("OS: %s/%s", runtime.GOOS, runtime.GOARCH) + logMsg("Install dir: %s", config.InstallDir) + logMsg("") + steps := []struct { name string percent float64 @@ -225,13 +245,16 @@ func (inst *Installer) runInstall(config InstallConfig) { }) if err := step.fn(config); err != nil { + logMsg("[FAIL] %s: %s", step.name, err) if step.critical { inst.emitProgress(ProgressEvent{ Step: step.name, - Message: fmt.Sprintf("Error: %s — %s", step.name, err), + Message: fmt.Sprintf("Error: %s — %s (see log: %s)", step.name, err, logPath), Percent: step.percent, IsError: true, }) + logMsg("") + logMsg("Installation ABORTED.") return // abort installation } inst.emitProgress(ProgressEvent{ @@ -240,12 +263,17 @@ func (inst *Installer) runInstall(config InstallConfig) { Percent: step.percent, IsError: true, }) + } else { + logMsg("[ OK ] %s", step.name) } } + logMsg("") + logMsg("Installation COMPLETE.") + inst.emitProgress(ProgressEvent{ Step: "complete", - Message: "Installation complete!", + Message: fmt.Sprintf("Installation complete! Log: %s", logPath), Percent: 100, IsComplete: true, })