mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
Fixes #1206. ERROR level used in Production
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/wailsapp/wails/v2/internal/frontend/runtime"
|
||||
"github.com/wailsapp/wails/v2/internal/logger"
|
||||
"github.com/wailsapp/wails/v2/internal/menumanager"
|
||||
pkgLog "github.com/wailsapp/wails/v2/pkg/logger"
|
||||
"github.com/wailsapp/wails/v2/pkg/options"
|
||||
)
|
||||
|
||||
@@ -50,10 +51,18 @@ func CreateApp(appoptions *options.App) (*App, error) {
|
||||
// Merge default options
|
||||
options.MergeDefaults(appoptions)
|
||||
|
||||
debug := IsDebug()
|
||||
ctx = context.WithValue(ctx, "debug", debug)
|
||||
|
||||
// Set up logger
|
||||
myLogger := logger.New(appoptions.Logger)
|
||||
myLogger.SetLogLevel(appoptions.LogLevel)
|
||||
|
||||
if !IsDebug() {
|
||||
myLogger.SetLogLevel(pkgLog.ERROR)
|
||||
}
|
||||
ctx = context.WithValue(ctx, "logger", myLogger)
|
||||
|
||||
// Preflight Checks
|
||||
err = PreflightChecks(appoptions, myLogger)
|
||||
if err != nil {
|
||||
@@ -78,11 +87,8 @@ func CreateApp(appoptions *options.App) (*App, error) {
|
||||
ctx = context.WithValue(ctx, "events", eventHandler)
|
||||
messageDispatcher := dispatcher.NewDispatcher(myLogger, appBindings, eventHandler)
|
||||
|
||||
debug := IsDebug()
|
||||
ctx = context.WithValue(ctx, "debug", debug)
|
||||
// Attach logger to context
|
||||
if debug {
|
||||
ctx = context.WithValue(ctx, "logger", myLogger)
|
||||
ctx = context.WithValue(ctx, "buildtype", "debug")
|
||||
} else {
|
||||
ctx = context.WithValue(ctx, "buildtype", "production")
|
||||
|
||||
Reference in New Issue
Block a user