From a1649391616f782b9d7688b610af7dcd16a9a409 Mon Sep 17 00:00:00 2001 From: josc146 Date: Mon, 11 Dec 2023 12:02:24 +0800 Subject: [PATCH] add crash.log --- main.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/main.go b/main.go index 7f79664..41ff093 100644 --- a/main.go +++ b/main.go @@ -11,6 +11,7 @@ import ( backend "rwkv-runner/backend-golang" "github.com/wailsapp/wails/v2" + wailsLogger "github.com/wailsapp/wails/v2/pkg/logger" "github.com/wailsapp/wails/v2/pkg/options" "github.com/wailsapp/wails/v2/pkg/options/assetserver" "github.com/wailsapp/wails/v2/pkg/options/windows" @@ -66,7 +67,10 @@ var midiAssets embed.FS var components embed.FS func main() { + dev := true if buildInfo, ok := debug.ReadBuildInfo(); !ok || strings.Contains(buildInfo.String(), "-ldflags") { + dev = false + backend.CopyEmbed(assets) os.RemoveAll("./py310/Lib/site-packages/cyac-1.7.dist-info") backend.CopyEmbed(cyac) @@ -94,6 +98,13 @@ func main() { app.HasConfigData = false } + var logger wailsLogger.Logger + if dev { + logger = wailsLogger.NewDefaultLogger() + } else { + logger = wailsLogger.NewFileLogger("crash.log") + } + // Create application with options err = wails.Run(&options.App{ Title: "RWKV-Runner", @@ -115,6 +126,7 @@ func main() { Bind: []any{ app, }, + Logger: logger, }) if err != nil {