Improve logging #2

Merged
eburk merged 6 commits from improve-logging into main 2025-07-24 15:30:33 +00:00
19 changed files with 338 additions and 238 deletions
Showing only changes of commit 67daf7027d - Show all commits

6
go.mod
View File

@@ -6,7 +6,8 @@ toolchain go1.24.5
require (
fyne.io/fyne/v2 v2.6.1
git.burkey.co/eburk/epochcli v0.0.0-20250721041733-516a1f9b570e
git.burkey.co/eburk/epochcli v0.0.0-20250724134158-4d47056e5b16
github.com/rs/zerolog v1.34.0
github.com/zalando/go-keyring v0.2.6
howett.net/plist v1.0.1
)
@@ -38,12 +39,11 @@ require (
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
github.com/nicksnyder/go-i18n/v2 v2.6.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rs/zerolog v1.34.0 // indirect
github.com/rymdport/portal v0.4.2 // indirect
github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c // indirect
github.com/srwiley/rasterx v0.0.0-20220730225603-2ab79fcdd4ef // indirect
github.com/stretchr/testify v1.10.0 // indirect
github.com/yuin/goldmark v1.7.12 // indirect
github.com/yuin/goldmark v1.7.13 // indirect
golang.org/x/image v0.29.0 // indirect
golang.org/x/net v0.42.0 // indirect
golang.org/x/sys v0.34.0 // indirect

6
go.sum
View File

@@ -12,6 +12,10 @@ git.burkey.co/eburk/epochcli v0.0.0-20250721041340-6b6dbdda99e2 h1:89rNJ5p6gYJPZ
git.burkey.co/eburk/epochcli v0.0.0-20250721041340-6b6dbdda99e2/go.mod h1:DgybCn9/LpJwvkrsyea9N2nWy/wuDgo6jkpOWYkTH3c=
git.burkey.co/eburk/epochcli v0.0.0-20250721041733-516a1f9b570e h1:WN1jlnC3sc/2ix70bzMPpzsPdsE/pqUIR/Vw8cVEkw8=
git.burkey.co/eburk/epochcli v0.0.0-20250721041733-516a1f9b570e/go.mod h1:DgybCn9/LpJwvkrsyea9N2nWy/wuDgo6jkpOWYkTH3c=
git.burkey.co/eburk/epochcli v0.0.0-20250723150949-7f454dc63253 h1:g/+ztvoMIJD80jSn7V388T6D8KMTqvZDcjc0B482e3A=
git.burkey.co/eburk/epochcli v0.0.0-20250723150949-7f454dc63253/go.mod h1:DgybCn9/LpJwvkrsyea9N2nWy/wuDgo6jkpOWYkTH3c=
git.burkey.co/eburk/epochcli v0.0.0-20250724134158-4d47056e5b16 h1:L67RkxnNIpCoqy7dpN4XdPdNxQEFwA0/B2gisvUwNow=
git.burkey.co/eburk/epochcli v0.0.0-20250724134158-4d47056e5b16/go.mod h1:DgybCn9/LpJwvkrsyea9N2nWy/wuDgo6jkpOWYkTH3c=
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
@@ -122,6 +126,8 @@ github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic=
github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
github.com/yuin/goldmark v1.7.12 h1:YwGP/rrea2/CnCtUHgjuolG/PnMxdQtPMO5PvaE2/nY=
github.com/yuin/goldmark v1.7.12/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg=
github.com/yuin/goldmark v1.7.13 h1:GPddIs617DnBLFFVJFgpo1aBfe/4xcvMc3SB5t/D0pA=
github.com/yuin/goldmark v1.7.13/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg=
github.com/zalando/go-keyring v0.2.6 h1:r7Yc3+H+Ux0+M72zacZoItR3UDxeWfKTcabvkI8ua9s=
github.com/zalando/go-keyring v0.2.6/go.mod h1:2TCrxYrbUNYfNS/Kgy/LSrkSQzZ5UPVH85RwfczwvcI=
golang.org/x/image v0.24.0 h1:AN7zRgVsbvmTfNyqIbbOraYL8mSwcKncEj8ofjgzcMQ=

View File

@@ -205,20 +205,24 @@ func PatchEpoch(myWindow fyne.Window, updateAllStatuses func()) {
dialog.ShowInformation("Downloading patches", "Downloading patches for Project Epoch, this will take some time. Please wait until the status changes to \"Patched\"", myWindow)
paths.DownloadingPatches = true
go func() {
stats, err := epoch.Update(paths.EpochPath, true, true, false)
if err != nil {
errMsg := fmt.Sprintf("failed to update Epoch files: %v", err)
log.Debug("Attempting to download patches...")
stats := epoch.Update(paths.EpochPath, true, true, false)
if stats.Error != nil {
errMsg := fmt.Sprintf("failed to update Epoch files: %v", stats.Error)
fyne.Do(func() {
dialog.ShowError(errors.New(errMsg), myWindow)
})
paths.DownloadingPatches = false
log.Error(errMsg)
} else {
for _, msg := range stats.LogMessages {
log.Debug(msg)
}
log.Infof("Successfully updated %d Epoch files", stats.Updated)
log.Debug("Epoch patching with bundled resources completed successfully.")
fyne.Do(func() {
dialog.ShowInformation("Success", "Epoch patching process completed.", myWindow)
})
}
log.Infof("Successfully updated %d Epoch files", stats.Updated)
log.Debug("Epoch patching with bundled resources completed successfully.")
fyne.Do(func() {
dialog.ShowInformation("Success", "Epoch patching process completed.", myWindow)
})
fyne.DoAndWait(func() {
paths.DownloadingPatches = false
updateAllStatuses()

View File

@@ -108,13 +108,14 @@ func updateEpochStatus() {
// Check for Epoch-specific files
epochPatchesApplied := false
stats, err := epoch.Update(paths.EpochPath, false, true, true)
if err != nil {
log.Debugf("Failed to get download Epoch patches: %v", err)
}
if stats.Outdated == 0 {
log.Debug("Nothing is outdated")
epochPatchesApplied = true
stats := epoch.Update(paths.EpochPath, false, true, true)
if stats.Error != nil {
log.Error(stats.Error.Error())
} else {
if stats.Outdated == 0 {
log.Debug("Everything is up-to-date!")
epochPatchesApplied = true
}
}
// Check if patched files have the correct size (matches bundled versions)