feat: zap日志配置
This commit is contained in:
@@ -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")
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user