feat: add comprehensive diagnostic logging subsystem and UI controls

This commit is contained in:
CAtlas0784 committed 2026-10-30 23:08:23 +07:00
1 parent 517436321b
commit 5f45841936
15 files changed
+495 -23

No files matched your search

+17 -5
View File
@@ -11,10 +11,11 @@ import (
languageService "g-launcher/internal/language-service"
"g-launcher/pkg/constant"
"g-launcher/pkg/logger"
"fmt"
"log"
"os"
"path/filepath"
"runtime"
"github.com/wailsapp/wails/v3/pkg/application"
"github.com/wailsapp/wails/v3/pkg/events"
@@ -45,12 +46,23 @@ func extractFile(embedPath, outPath string) error {
}
func main() {
_, err := logger.Init()
if err != nil {
fmt.Printf("failed to initialize logger: %v\n", err)
}
logger.Info("G-Launcher starting up (Version: %s, OS: %s, Arch: %s, Go: %s)", constant.CurrentLauncherVersion, runtime.GOOS, runtime.GOARCH, runtime.Version())
cwd, _ := os.Getwd()
logger.Info("Current Working Directory: %s", cwd)
// Extract required files
for outPath, embedPath := range constant.RequiredFiles {
if !fileExists(outPath.String()) {
err := extractFile(embedPath, outPath.String())
if err != nil {
fmt.Println("can't copy file:", err)
logger.Error("Can't extract file %s: %v", outPath, err)
} else {
logger.Info("Extracted embedded asset: %s", outPath)
}
}
}
@@ -62,8 +74,8 @@ func main() {
base := filepath.Base(exePath)
oldPath := filepath.Join(dir, "."+base+".old")
fmt.Println("Old executable path:", oldPath)
os.Remove(oldPath)
logger.Info("Checking for old executable: %s", oldPath)
_ = os.Remove(oldPath)
}
// Create application
app := application.New(application.Options{
@@ -124,6 +136,6 @@ func main() {
err = app.Run()
if err != nil {
log.Fatal(err)
logger.Error("Application fatal error: %v", err)
}
}