mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-19 02:19:31 +08:00
[v3] Use system logger instead of println
This commit is contained in:
parent
6edd667bdf
commit
d44c8eba1c
@ -88,7 +88,7 @@ func New(appOptions Options) *App {
|
||||
|
||||
result.bindings, err = NewBindings(appOptions.Bind, appOptions.BindAliases)
|
||||
if err != nil {
|
||||
println("Fatal error in application initialisation: ", err.Error())
|
||||
globalApplication.fatal("Fatal error in application initialisation: " + err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ func New(appOptions Options) *App {
|
||||
|
||||
err = result.bindings.AddPlugins(appOptions.Plugins)
|
||||
if err != nil {
|
||||
println("Fatal error in application initialisation: ", err.Error())
|
||||
globalApplication.fatal("Fatal error in application initialisation: " + err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
@ -306,7 +306,7 @@ func (m *windowsApp) unregisterWindow(w *windowsWebviewWindow) {
|
||||
func newPlatformApp(app *App) *windowsApp {
|
||||
err := w32.SetProcessDPIAware()
|
||||
if err != nil {
|
||||
println("Fatal error in application initialisation: ", err.Error())
|
||||
globalApplication.fatal("Fatal error in application initialisation: ", err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ func showCfdDialog(newDlg func() (cfd.Dialog, error), isMultiSelect bool) (any,
|
||||
defer func() {
|
||||
err := dlg.Release()
|
||||
if err != nil {
|
||||
println("ERROR: Unable to release dialog:", err.Error())
|
||||
globalApplication.error("Unable to release dialog: " + err.Error())
|
||||
}
|
||||
}()
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package application
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
@ -179,7 +180,7 @@ func newRole(role Role) *MenuItem {
|
||||
return newFullScreenMenuItem()
|
||||
|
||||
default:
|
||||
println("No support for role:", role)
|
||||
globalApplication.error(fmt.Sprintf("No support for role: %v", role))
|
||||
os.Exit(1)
|
||||
}
|
||||
return nil
|
||||
@ -219,7 +220,7 @@ func (m *MenuItem) handleClick() {
|
||||
func (m *MenuItem) SetAccelerator(shortcut string) *MenuItem {
|
||||
accelerator, err := parseAccelerator(shortcut)
|
||||
if err != nil {
|
||||
println("ERROR: invalid accelerator:", err.Error())
|
||||
globalApplication.error("invalid accelerator:", err.Error())
|
||||
return m
|
||||
}
|
||||
m.accelerator = accelerator
|
||||
|
@ -46,7 +46,7 @@ func systrayClickCallback(id C.long, buttonID C.int) {
|
||||
// Get the system tray
|
||||
systemTray := systemTrayMap[uint(id)]
|
||||
if systemTray == nil {
|
||||
println("system tray not found")
|
||||
globalApplication.error("system tray not found", "id", id)
|
||||
return
|
||||
}
|
||||
systemTray.processClick(button(buttonID))
|
||||
|
@ -167,7 +167,7 @@ func (s *windowsSystemTray) run() {
|
||||
// Set Default Callbacks
|
||||
if s.parent.clickHandler == nil {
|
||||
s.parent.clickHandler = func() {
|
||||
println("Left Button Clicked")
|
||||
globalApplication.info("Left Button Clicked")
|
||||
}
|
||||
}
|
||||
if s.parent.rightClickHandler == nil {
|
||||
|
@ -846,12 +846,12 @@ func (w *macosWebviewWindow) toggleDevTools() {
|
||||
|
||||
func (w *macosWebviewWindow) reload() {
|
||||
//TODO: Implement
|
||||
println("reload called on WebviewWindow", w.parent.id)
|
||||
globalApplication.info("reload called on WebviewWindow", "parentID", w.parent.id)
|
||||
}
|
||||
|
||||
func (w *macosWebviewWindow) forceReload() {
|
||||
//TODO: Implement
|
||||
println("forceReload called on WebviewWindow", w.parent.id)
|
||||
globalApplication.info("force reload called on WebviewWindow", "parentID", w.parent.id)
|
||||
}
|
||||
|
||||
func (w *macosWebviewWindow) center() {
|
||||
|
@ -64,11 +64,7 @@ func SetTheme(hwnd uintptr, useDarkMode bool) {
|
||||
}
|
||||
|
||||
func EnableTranslucency(hwnd uintptr, backdrop int32) {
|
||||
if SupportsBackdropTypes() {
|
||||
dwmSetWindowAttribute(hwnd, DwmwaSystemBackdropType, unsafe.Pointer(&backdrop), unsafe.Sizeof(backdrop))
|
||||
} else {
|
||||
println("Warning: Translucency type unavailable on Windows < 22621")
|
||||
}
|
||||
}
|
||||
|
||||
func SetTitleBarColour(hwnd uintptr, titleBarColour int32) {
|
||||
|
@ -39,7 +39,7 @@ func (kvs *KeyValueStore) Shutdown() {
|
||||
if kvs.unsaved {
|
||||
err := kvs.Save()
|
||||
if err != nil {
|
||||
println("Error saving store: " + err.Error())
|
||||
application.Get().Logger.Error("Error saving store: " + err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user