fix flags

This commit is contained in:
Roy Crihfield 2023-09-27 21:46:24 +08:00
parent e9ec4a23dd
commit b64032282b

View File

@ -45,7 +45,7 @@ func Execute() {
} }
func initFuncs(cmd *cobra.Command, args []string) { func initFuncs(cmd *cobra.Command, args []string) {
logfile := viper.GetString("logfile") logfile := viper.GetString("log.file")
if logfile != "" { if logfile != "" {
file, err := os.OpenFile(logfile, file, err := os.OpenFile(logfile,
os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666) os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
@ -65,7 +65,7 @@ func initFuncs(cmd *cobra.Command, args []string) {
} }
func logLevel() error { func logLevel() error {
viper.BindEnv("log.level", "LOGRUS_LEVEL") viper.BindEnv("log.level", "LOG_LEVEL")
lvl, err := log.ParseLevel(viper.GetString("log.level")) lvl, err := log.ParseLevel(viper.GetString("log.level"))
if err != nil { if err != nil {
return err return err