This commit is contained in:
wjqserver 2025-04-08 20:48:56 +08:00
parent 8a50b311fc
commit 3e9e43cd44
3 changed files with 19 additions and 6 deletions

View file

@ -1,5 +1,11 @@
# 更新日志 # 更新日志
3.0.1 -2025-04-08
---
- CHANGE: 加入`memLimit`指示gc
- CHANGE: 加入`hlog`输出路径配置
- CHANGE: 修正H2C配置问题
25w27a - 2025-04-07 25w27a - 2025-04-07
--- ---
- PRE-RELEASE: 此版本是v3.0.1的预发布版本,请勿在生产环境中使用; - PRE-RELEASE: 此版本是v3.0.1的预发布版本,请勿在生产环境中使用;

View file

@ -1 +1 @@
3.0.0 3.0.1

17
main.go
View file

@ -141,12 +141,12 @@ func setupHertZLogger(cfg *config.Config) {
if cfg.Log.HertZLogPath != "" { if cfg.Log.HertZLogPath != "" {
hertZfile, err = os.OpenFile(cfg.Log.HertZLogPath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644) hertZfile, err = os.OpenFile(cfg.Log.HertZLogPath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)
if err != nil { if err != nil {
fmt.Printf("Failed to open log file: %v\n", err) hlog.SetOutput(os.Stdout)
os.Exit(1) logWarning("Failed to open hertz log file: %v", err)
} } else {
hlog.SetOutput(hertZfile) hlog.SetOutput(hertZfile)
} }
}
} }
@ -446,6 +446,13 @@ func main() {
r.Spin() r.Spin()
defer logger.Close() defer logger.Close()
defer hertZfile.Close() defer func() {
if hertZfile != nil {
err := hertZfile.Close()
if err != nil {
logError("Failed to close hertz log file: %v", err)
}
}
}()
fmt.Println("Program Exit") fmt.Println("Program Exit")
} }