Refactor debug logs

This commit is contained in:
2020-02-03 19:00:21 +01:00
parent 245029b759
commit 0d6b195b99
2 changed files with 37 additions and 47 deletions

View File

@ -4,7 +4,7 @@ import (
"flag"
"github.com/cyrilix/robocar-arduino/arduino"
"github.com/cyrilix/robocar-base/cli"
"log"
log "github.com/sirupsen/logrus"
"os"
)
@ -38,13 +38,17 @@ func main() {
os.Exit(1)
}
if debug {
log.SetLevel(log.DebugLevel)
}
client, err := cli.Connect(mqttBroker, username, password, clientId)
if err != nil {
log.Fatalf("unable to connect to mqtt broker: %v", err)
}
defer client.Disconnect(10)
a := arduino.NewPart(client, device, baud, throttleTopic, steeringTopic, driveModeTopic, switchRecordTopic, pubFrequency, debug)
a := arduino.NewPart(client, device, baud, throttleTopic, steeringTopic, driveModeTopic, switchRecordTopic, pubFrequency)
err = a.Start()
if err != nil {
log.Printf("unable to start service: %v", err)