Add per area log levels at command line (#4813)

This commit is contained in:
andig 2022-10-14 17:51:53 +02:00 • committed by GitHub
parent e5a65bc1b9
commit bafb3a7e79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 27 additions and 69 deletions

View file

@ -4,11 +4,8 @@ import (
"fmt"
"strings"
"github.com/evcc-io/evcc/server"
"github.com/evcc-io/evcc/util"
"github.com/samber/lo"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"golang.org/x/exp/slices"
"golang.org/x/oauth2"
)
@ -25,16 +22,11 @@ func init() {
}
func runToken(cmd *cobra.Command, args []string) {
util.LogLevel(viper.GetString("log"), viper.GetStringMapString("levels"))
log.INFO.Printf("evcc %s", server.FormattedVersion())
// load config
if err := loadConfigFile(&conf); err != nil {
log.FATAL.Fatal(err)
}
util.LogLevel(viper.GetString("log"), viper.GetStringMapString("levels"))
var vehicleConf qualifiedConfig
if len(conf.Vehicles) == 1 {
vehicleConf = conf.Vehicles[0]