From dd1ff27a3e697f550ad416a1debdb34d626a73c4 Mon Sep 17 00:00:00 2001 From: Orne Brocaar Date: Sun, 6 Mar 2016 18:29:50 +0100 Subject: [PATCH] Set log-level. Add github link. --- cmd/semtech-bridge/main.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmd/semtech-bridge/main.go b/cmd/semtech-bridge/main.go index b097af1f..bb7c273e 100644 --- a/cmd/semtech-bridge/main.go +++ b/cmd/semtech-bridge/main.go @@ -17,6 +17,8 @@ import ( var version string // set by the compiler func run(c *cli.Context) { + log.SetLevel(log.Level(uint8(c.Int("log-level")))) + pubsub, err := mqttpubsub.NewBackend(c.String("mqtt-server"), c.String("mqtt-username"), c.String("mqtt-password")) if err != nil { log.Fatalf("could not setup mqtt backend: %s", err) @@ -71,6 +73,7 @@ func main() { app := cli.NewApp() app.Name = "semtech-bridge" app.Usage = "Semtech UDP protocol speaking gateway <-> MQTT" + app.Copyright = "See http://github.com/brocaar/lora-semtech-bridge for copyright information" app.Version = version app.Action = run app.Flags = []cli.Flag{ @@ -96,6 +99,12 @@ func main() { Usage: "MQTT password", EnvVar: "MQTT_PASSWORD", }, + cli.IntFlag{ + Name: "log-level", + Value: 4, + Usage: "debug=5, info=4, warning=3, error=2, fatal=1, panic=0", + EnvVar: "LOG_LEVEL", + }, } app.Run(os.Args) }