[windows] Fix production logger. Add alpha assets

This commit is contained in:
Lea Anthony 2023-10-09 17:36:06 +11:00
commit 83ed7fd2df
No known key found for this signature in database
GPG key ID: 33DAF7BB90A58405
2 changed files with 95 additions and 2 deletions

View file

@ -1,7 +1,9 @@
package application
import (
"embed"
"encoding/json"
"io"
"log"
"log/slog"
"net/http"
@ -23,8 +25,16 @@ import (
"github.com/wailsapp/wails/v3/pkg/events"
)
//go:embed assets/*
var alphaAssets embed.FS
var globalApplication *App
// AlphaAssets is the default assets for the alpha application
var AlphaAssets = AssetOptions{
FS: alphaAssets,
}
func init() {
runtime.LockOSThread()
}
@ -47,8 +57,12 @@ func New(appOptions Options) *App {
result := newApplication(appOptions)
globalApplication = result
if result.isDebugMode && result.Logger == nil {
result.Logger = DefaultLogger(result.options.LogLevel)
if result.Logger == nil {
if result.isDebugMode {
result.Logger = DefaultLogger(result.options.LogLevel)
} else {
result.Logger = slog.New(slog.NewTextHandler(io.Discard, nil))
}
}
result.logStartup()

File diff suppressed because one or more lines are too long