diff --git a/server/core/server.go b/server/core/server.go index 7cfba6ea..5656a2d1 100644 --- a/server/core/server.go +++ b/server/core/server.go @@ -25,7 +25,7 @@ func RunWindowsServer() { // 保证文本顺序输出 // In order to ensure that the text order output can be deleted time.Sleep(10 * time.Microsecond) - global.GVA_LOG.Debug("server run success on ", zap.String("address", address)) + global.GVA_LOG.Info("server run success on ", zap.String("address", address)) fmt.Printf(`欢迎使用 Gin-Vue-Admin 默认自动化文档地址:http://127.0.0.1%s/swagger/index.html diff --git a/server/core/zap.go b/server/core/zap.go index fc68a474..d3597433 100644 --- a/server/core/zap.go +++ b/server/core/zap.go @@ -82,30 +82,20 @@ func getEncoderConfig() (config zapcore.EncoderConfig) { CallerKey: "caller", StacktraceKey: global.GVA_CONFIG.Zap.StacktraceKey, LineEnding: zapcore.DefaultLineEnding, - EncodeLevel: zapcore.CapitalLevelEncoder, + EncodeLevel: zapcore.LowercaseLevelEncoder, EncodeTime: CustomTimeEncoder, EncodeDuration: zapcore.SecondsDurationEncoder, EncodeCaller: zapcore.FullCallerEncoder, } switch { - case global.GVA_CONFIG.Zap.EncodeLevel == "LowercaseLevelEncoder" && global.GVA_CONFIG.Zap.Format == "console" : // console小写编码器 + case global.GVA_CONFIG.Zap.EncodeLevel == "LowercaseLevelEncoder": // 小写编码器(默认) config.EncodeLevel = zapcore.LowercaseLevelEncoder - case global.GVA_CONFIG.Zap.EncodeLevel == "LowercaseLevelEncoder" && global.GVA_CONFIG.Zap.Format == "json" : // json小写编码器 - config.EncodeLevel = zapcore.LowercaseLevelEncoder - case global.GVA_CONFIG.Zap.EncodeLevel == "LowercaseColorLevelEncoder" && global.GVA_CONFIG.Zap.Format == "console": // console小写编码器带颜色 - config.EncodeLevel = zapcore.LowercaseColorLevelEncoder - case global.GVA_CONFIG.Zap.EncodeLevel == "LowercaseColorLevelEncoder" && global.GVA_CONFIG.Zap.Format == "json": // json小写编码器带颜色 + case global.GVA_CONFIG.Zap.EncodeLevel == "LowercaseColorLevelEncoder": // 小写编码器带颜色 config.EncodeLevel = zapcore.LowercaseColorLevelEncoder - case global.GVA_CONFIG.Zap.EncodeLevel == "CapitalLevelEncoder" && global.GVA_CONFIG.Zap.Format == "console": // console大写编码器 - config.EncodeLevel = zapcore.CapitalLevelEncoder - case global.GVA_CONFIG.Zap.EncodeLevel == "CapitalLevelEncoder" && global.GVA_CONFIG.Zap.Format == "json": // json大写编码器 + case global.GVA_CONFIG.Zap.EncodeLevel == "CapitalLevelEncoder": // 大写编码器 config.EncodeLevel = zapcore.CapitalLevelEncoder - case global.GVA_CONFIG.Zap.EncodeLevel == "CapitalColorLevelEncoder" && global.GVA_CONFIG.Zap.Format == "console": // console 大写编码器带颜色 + case global.GVA_CONFIG.Zap.EncodeLevel == "CapitalColorLevelEncoder": // 大写编码器带颜色 config.EncodeLevel = zapcore.CapitalColorLevelEncoder - case global.GVA_CONFIG.Zap.EncodeLevel == "CapitalColorLevelEncoder" && global.GVA_CONFIG.Zap.Format == "json": // json 大写编码器带颜色 - config.EncodeLevel = zapcore.CapitalColorLevelEncoder - default: - config.EncodeLevel = zapcore.LowercaseLevelEncoder } return config } diff --git a/server/gva/init_data/init_data.go b/server/gva/init_data/init_data.go index 5aff1dd4..41e4441b 100644 --- a/server/gva/init_data/init_data.go +++ b/server/gva/init_data/init_data.go @@ -481,5 +481,5 @@ func InitData() { if err != nil { global.GVA_LOG.Error("initialize data failed", zap.Any("err", err)) } - global.GVA_LOG.Debug("initialize data success") + global.GVA_LOG.Info("initialize data success") } diff --git a/server/initialize/gorm.go b/server/initialize/gorm.go index 7428740c..bc76d106 100644 --- a/server/initialize/gorm.go +++ b/server/initialize/gorm.go @@ -52,7 +52,7 @@ func GormDBTables(db *gorm.DB) { global.GVA_LOG.Error("register table failed", zap.Any("err", err)) os.Exit(0) } - global.GVA_LOG.Debug("register table success") + global.GVA_LOG.Info("register table success") } // GormMysql 初始化Mysql数据库 diff --git a/server/initialize/router.go b/server/initialize/router.go index 58542251..403ddc29 100644 --- a/server/initialize/router.go +++ b/server/initialize/router.go @@ -18,12 +18,12 @@ func Routers() *gin.Engine { // 为用户头像和文件提供静态地址 Router.StaticFS(global.GVA_CONFIG.LocalUpload.FilePath, http.Dir(global.GVA_CONFIG.LocalUpload.FilePath)) // Router.Use(middleware.LoadTls()) // 打开就能玩https了 - global.GVA_LOG.Debug("use middleware logger") + global.GVA_LOG.Info("use middleware logger") // 跨域 Router.Use(middleware.Cors()) - global.GVA_LOG.Debug("use middleware cors") + global.GVA_LOG.Info("use middleware cors") Router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) - global.GVA_LOG.Debug("register swagger handler") + global.GVA_LOG.Info("register swagger handler") // 方便统一添加路由组前缀 多服务器上线使用 ApiGroup := Router.Group("") router.InitUserRouter(ApiGroup) // 注册用户路由