wails/v3/pkg/application/application_debug.go
Lea Anthony a05838d5fa fix: convert all printf-style info() calls to slog-style
Convert remaining info() calls that were using printf-style format
strings to slog-style structured logging (key-value pairs):

- application_ios.go: iOS log messages and HandleJSMessage calls
- webview_window_windows.go: WM_SYSKEYDOWN logging
- application.go: handleWindowMessage and handleWebViewRequest logging

Also removed debug fmt.Printf statements from handleWebViewRequest.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-12 06:36:05 +11:00

71 lines
1.7 KiB
Go

//go:build !production
package application
import (
"github.com/go-git/go-git/v5"
"github.com/samber/lo"
"github.com/wailsapp/wails/v3/internal/version"
"path/filepath"
"runtime/debug"
)
// BuildSettings contains the build settings for the application
var BuildSettings map[string]string
// BuildInfo contains the build info for the application
var BuildInfo *debug.BuildInfo
func init() {
var ok bool
BuildInfo, ok = debug.ReadBuildInfo()
if !ok {
return
}
BuildSettings = lo.Associate(BuildInfo.Settings, func(setting debug.BuildSetting) (string, string) {
return setting.Key, setting.Value
})
}
// We use this to patch the application to production mode.
func newApplication(options Options) *App {
result := &App{
isDebugMode: true,
options: options,
}
result.init()
return result
}
func (a *App) logStartup() {
var args []any
// BuildInfo is nil when build with garble
if BuildInfo == nil {
return
}
wailsPackage, _ := lo.Find(BuildInfo.Deps, func(dep *debug.Module) bool {
return dep.Path == "github.com/wailsapp/wails/v3"
})
wailsVersion := version.String()
if wailsPackage != nil && wailsPackage.Replace != nil {
wailsVersion = "(local) => " + filepath.ToSlash(wailsPackage.Replace.Path)
// Get the latest commit hash
repo, err := git.PlainOpen(filepath.Join(wailsPackage.Replace.Path, ".."))
if err == nil {
head, err := repo.Head()
if err == nil {
wailsVersion += " (" + head.Hash().String()[:8] + ")"
}
}
}
args = append(args, "Wails", wailsVersion)
args = append(args, "Compiler", BuildInfo.GoVersion)
for key, value := range BuildSettings {
args = append(args, key, value)
}
a.info("Build Info:", args...)
}