Skip to content

Commit dd1ff27

Browse files
committed
Set log-level. Add github link.
1 parent 861b568 commit dd1ff27

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cmd/semtech-bridge/main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import (
1717
var version string // set by the compiler
1818

1919
func run(c *cli.Context) {
20+
log.SetLevel(log.Level(uint8(c.Int("log-level"))))
21+
2022
pubsub, err := mqttpubsub.NewBackend(c.String("mqtt-server"), c.String("mqtt-username"), c.String("mqtt-password"))
2123
if err != nil {
2224
log.Fatalf("could not setup mqtt backend: %s", err)
@@ -71,6 +73,7 @@ func main() {
7173
app := cli.NewApp()
7274
app.Name = "semtech-bridge"
7375
app.Usage = "Semtech UDP protocol speaking gateway <-> MQTT"
76+
app.Copyright = "See http://github.com/brocaar/lora-semtech-bridge for copyright information"
7477
app.Version = version
7578
app.Action = run
7679
app.Flags = []cli.Flag{
@@ -96,6 +99,12 @@ func main() {
9699
Usage: "MQTT password",
97100
EnvVar: "MQTT_PASSWORD",
98101
},
102+
cli.IntFlag{
103+
Name: "log-level",
104+
Value: 4,
105+
Usage: "debug=5, info=4, warning=3, error=2, fatal=1, panic=0",
106+
EnvVar: "LOG_LEVEL",
107+
},
99108
}
100109
app.Run(os.Args)
101110
}

0 commit comments

Comments
 (0)