优化日志

This commit is contained in:
liuxiaobo 2025-05-30 23:15:53 +08:00
parent 41c32e5fa7
commit 2217959df3
6 changed files with 9 additions and 6 deletions

View File

@ -16,6 +16,7 @@ func initRepo() {
}
func Run(GitCommit, GitBranch, BuildDate string) {
config.InitLog()
config.LoadConfig(GitCommit, GitBranch, BuildDate)
log.Info(fmt.Sprintf("版本分支:%v,hash值:%v,编译时间:%v", GitBranch, GitCommit, BuildDate))
initRepo()

View File

@ -12,13 +12,13 @@ var Cfg *config.Common[ChatConfig]
type ChatConfig struct {
}
func initLog() {
func InitLog() {
log.Open("./log/chat.log", log.DebugL)
log.Info("\n\n\ninit log success")
}
func LoadConfig(GitCommit, GitBranch, BuildDate string) {
Command = config.ParseCommand()
initLog()
rdb, err := db.InitRedis(Command.RedisPassword, Command.RedisHost, Command.RedisPort, 0)
if err != nil {
log.Error(err.Error())

View File

@ -16,6 +16,7 @@ func initRepo() {
}
func Run(GitCommit, GitBranch, BuildDate string) {
config.InitLog()
config.LoadConfig(GitCommit, GitBranch, BuildDate)
log.Info(fmt.Sprintf("版本分支:%v,hash值:%v,编译时间:%v", GitBranch, GitCommit, BuildDate))
initRepo()

View File

@ -21,13 +21,13 @@ type GateConfig struct {
Address []string `json:"address"` // 网关地址
}
func initLog() {
func InitLog() {
log.Open("./log/gate.log", log.DebugL)
log.Info("\n\n\ninit log success")
}
func LoadConfig(GitCommit, GitBranch, BuildDate string) {
Command = config.ParseCommand()
initLog()
rdb, err := db.InitRedis(Command.RedisPassword, Command.RedisHost, Command.RedisPort, 0)
if err != nil {
log.Error(err.Error())

View File

@ -17,6 +17,7 @@ func initRepo() {
}
func Run(GitCommit, GitBranch, BuildDate string) {
config.InitLog()
config.LoadConfig(GitCommit, GitBranch, BuildDate)
log.Info(fmt.Sprintf("版本分支:%v,hash值:%v,编译时间:%v", GitBranch, GitCommit, BuildDate))
initRepo()

View File

@ -12,13 +12,13 @@ var Cfg *config.Common[LoginConfig]
type LoginConfig struct {
}
func initLog() {
func InitLog() {
log.Open("./log/login.log", log.DebugL)
log.Info("\n\n\ninit log success")
}
func LoadConfig(GitCommit, GitBranch, BuildDate string) {
Command = config.ParseCommand()
initLog()
rdb, err := db.InitRedis(Command.RedisPassword, Command.RedisHost, Command.RedisPort, 0)
if err != nil {
log.Error(err.Error())