add crash.log

This commit is contained in:
josc146 2023-12-11 12:02:24 +08:00
parent 09ab11ef01
commit a164939161

12
main.go
View File

@ -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 {