完成日志输出到文件、终端多处的处理

This commit is contained in:
2024-11-13 16:11:59 +08:00
parent 9b643f4352
commit 28291598bb
28 changed files with 175 additions and 330 deletions

View File

@@ -6,7 +6,7 @@ package cmd
import (
"game-driver/config"
"game-driver/internal"
"game-driver/pkg/logger"
"log"
"os"
"github.com/spf13/cobra"
@@ -56,11 +56,11 @@ func initConfig() {
// If a config file is found, read it in.
if err := viper.ReadInConfig(); err == nil {
logger.Infof("Using config file: %s", viper.ConfigFileUsed())
log.Printf("Using config file: %s", viper.ConfigFileUsed())
}
err := viper.Unmarshal(&config.C)
if err != nil {
logger.Panicln("unmarshal config failed: ", err)
log.Panicln("unmarshal config failed: ", err)
}
}