全面替换log为zap

This commit is contained in:
2024-11-08 18:42:13 +08:00
parent 3da1fe761e
commit edb8d30605
17 changed files with 269 additions and 55 deletions

View File

@@ -4,10 +4,9 @@ Copyright © 2024 慕枫Go <mapleafgo@163.com>
package cmd
import (
"fmt"
"game-driver/config"
"game-driver/internal"
"log"
"game-driver/pkg/logger"
"os"
"github.com/spf13/cobra"
@@ -57,11 +56,11 @@ func initConfig() {
// If a config file is found, read it in.
if err := viper.ReadInConfig(); err == nil {
fmt.Fprintln(os.Stderr, "Using config file:", viper.ConfigFileUsed())
logger.Infof("Using config file: %s", viper.ConfigFileUsed())
}
err := viper.Unmarshal(&config.C)
if err != nil {
log.Panicln("unmarshal config failed: ", err)
logger.Panicln("unmarshal config failed: ", err)
}
}