优化日志系统

This commit is contained in:
yml2213
2026-06-19 12:10:55 +08:00
parent 1805edc63a
commit 59b9dd12ef
11 changed files with 232 additions and 66 deletions
+3 -4
View File
@@ -5,7 +5,6 @@ import (
"image"
"image/color"
"image/png"
"log"
"os"
"path/filepath"
"time"
@@ -71,13 +70,13 @@ func (s *appState) saveSuccessImage(account Account, product Product, roleName s
path := filepath.Join(s.paths.SuccessDir, name)
file, err := os.Create(path)
if err != nil {
log.Printf("成功图片创建失败: %v", err)
logEvent("图片", "error", "成功图片创建失败: %v", err)
return
}
defer file.Close()
if err := png.Encode(file, img); err != nil {
log.Printf("成功图片保存失败: %v", err)
logEvent("图片", "error", "成功图片保存失败: %v", err)
return
}
log.Printf("成功图片已保存: %s", path)
logEvent("图片", "success", "成功图片已保存: %s", path)
}