feat: zap日志配置

This commit is contained in:
Blizzard
2025-04-25 12:58:31 +08:00
parent 1de88e2dac
commit 507c2bd11e
13 changed files with 424 additions and 3 deletions
+10 -3
View File
@@ -1,7 +1,7 @@
package main
import (
"fmt"
"go.uber.org/zap"
"sundynix-go/core"
"sundynix-go/global"
)
@@ -9,6 +9,13 @@ import (
func main() {
//初始化viper
global.Viper = core.Viper()
fmt.Println(global.Config.Mysql)
fmt.Println(global.Config.Redis)
//初始化zap
global.Logger = core.Zap()
//替换zap
zap.ReplaceGlobals(global.Logger)
global.Logger.Info("this is debug log")
global.Logger.Debug("this is debug log")
global.Logger.Error("this is error log")
}