1
0

refactor: migrate logger

This commit is contained in:
2026-07-15 15:33:05 +08:00
parent 1cc6b7b1ba
commit 9f7fd6e5e7
5 changed files with 112 additions and 22 deletions

View File

@@ -9,6 +9,7 @@ import (
"github.com/yyc12345/coconut-leaf/backend/cli"
"github.com/yyc12345/coconut-leaf/backend/config"
"github.com/yyc12345/coconut-leaf/backend/logger"
)
func main() {
@@ -18,7 +19,16 @@ func main() {
if err != nil {
log.Fatal(err)
}
_ = cfg
var loggerLevel logger.LoggerLevel
if cfg.Others.Debug {
loggerLevel = logger.Development
} else {
loggerLevel = logger.Production
}
logger := logger.New(loggerLevel)
_ = logger
// 创建默认的 Gin 引擎(包含 Logger 和 Recovery 中间件)
r := gin.Default()