fix: protocol v1
This commit is contained in:
@ -5,18 +5,22 @@ import (
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"os"
|
||||
|
||||
reach "forge.cadoles.com/cadoles/go-emlid/reach/client"
|
||||
"forge.cadoles.com/cadoles/go-emlid/reach/client/logger"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
var (
|
||||
host string = "192.168.42.1"
|
||||
filter string = ""
|
||||
host string = "192.168.42.1"
|
||||
filter string = ""
|
||||
rawLogLevel string = "ERROR"
|
||||
)
|
||||
|
||||
func init() {
|
||||
flag.StringVar(&rawLogLevel, "log-level", rawLogLevel, "log level")
|
||||
flag.StringVar(&host, "host", host, "the reachrs module host")
|
||||
flag.StringVar(&filter, "filter", filter, "filter the broadcast messages by name")
|
||||
}
|
||||
@ -27,6 +31,14 @@ func main() {
|
||||
ctx := context.Background()
|
||||
client := reach.NewClient(host)
|
||||
|
||||
logLevel, err := logger.ParseLevel(rawLogLevel)
|
||||
if err != nil {
|
||||
fmt.Printf("[FATAL] %+v", errors.WithStack(err))
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
slog.SetLogLoggerLevel(logLevel)
|
||||
|
||||
if err := client.Connect(ctx); err != nil {
|
||||
fmt.Printf("[FATAL] %+v", errors.WithStack(err))
|
||||
os.Exit(1)
|
||||
|
Reference in New Issue
Block a user