Add optional debug logging for frame decoding.

This commit is contained in:
Hendrik van Wyk
2020-09-25 15:03:49 +02:00
parent 86f3f0c8e3
commit 157736a99d
4 changed files with 17 additions and 5 deletions

View File

@@ -22,6 +22,7 @@ type config struct {
Username string `long:"mqtt.username" env:"MQTT_USERNAME" default:"" description:"Set the MQTT username"`
Password string `long:"mqtt.password" env:"MQTT_PASSWORD" default:"" description:"Set the MQTT password"`
}
Loglevel string `long:"loglevel" env:"LOGLEVEL" default:"info" description:"The log level to generate logs at. (\"panic\", \"fatal\", \"error\", \"warn\", \"info\", \"debug\", \"trace\")"`
}
func parseConfig() (*config, error) {

View File

@@ -58,6 +58,11 @@ func main() {
os.Exit(1)
}
log.Info("Starting invertergui")
logLevel, err := logrus.ParseLevel(conf.Loglevel)
if err != nil {
log.Fatalf("Could not parse log level: %v", err)
}
logrus.SetLevel(logLevel)
mk2, err := getMk2Device(conf.Data.Source, conf.Data.Host, conf.Data.Device)
if err != nil {