Skip to content

Commit afbfb29

Browse files
committed
Use hclog
1 parent 2a65f9d commit afbfb29

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ module github.com/netauth/netkeys
33
go 1.12
44

55
require (
6-
github.com/netauth/netauth v0.3.1
6+
github.com/hashicorp/go-hclog v0.9.2
7+
github.com/netauth/netauth v0.3.2-0.20191126055934-b70580ac7b4a
78
github.com/spf13/pflag v1.0.3
89
github.com/spf13/viper v1.3.2
910
)

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh
6262
github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg=
6363
github.com/netauth/netauth v0.3.1 h1:MeIZ3zvyteQvgti083M/rOobpz25XiSkS4RtIlJ168s=
6464
github.com/netauth/netauth v0.3.1/go.mod h1:J72ArpIVnQDgBUv/e6iCjg9U6yOrpLOF4o4UKQd51pQ=
65+
github.com/netauth/netauth v0.3.2-0.20191126052807-45dd4f18b054 h1:dqoeipCZqS58ri0a1iVu52R/0QoE5yPGv7XJfYjlpEI=
66+
github.com/netauth/netauth v0.3.2-0.20191126052807-45dd4f18b054/go.mod h1:J72ArpIVnQDgBUv/e6iCjg9U6yOrpLOF4o4UKQd51pQ=
67+
github.com/netauth/netauth v0.3.2-0.20191126055934-b70580ac7b4a h1:CrUOcvWLmF9pj5uv2sduBQFuba7o9fqf/xXKM3afneU=
68+
github.com/netauth/netauth v0.3.2-0.20191126055934-b70580ac7b4a/go.mod h1:J72ArpIVnQDgBUv/e6iCjg9U6yOrpLOF4o4UKQd51pQ=
6569
github.com/netauth/protocol v0.0.0-20191124005711-167b58b61c72 h1:TRWDX4YIgajtmV3DHPrj7J/mNcg1C0YiRNppdQACstg=
6670
github.com/netauth/protocol v0.0.0-20191124005711-167b58b61c72/go.mod h1:xaNx5CDzZAIQf/05XC49krheuDM51d0ghkBw8liKAag=
6771
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=

main.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@ package main
22

33
import (
44
"fmt"
5-
"io/ioutil"
6-
"log"
75
"os"
86
"strings"
97
"context"
108

119
"github.com/spf13/pflag"
1210
"github.com/spf13/viper"
11+
"github.com/hashicorp/go-hclog"
1312

1413
"github.com/netauth/netauth/pkg/netauth"
1514
_ "github.com/netauth/netauth/pkg/netauth/memory"
@@ -41,13 +40,13 @@ func main() {
4140

4241
// Shut off all the logging
4342
if !*verbose {
44-
log.SetFlags(0)
45-
log.SetOutput(ioutil.Discard)
43+
hclog.SetDefault(hclog.NewNullLogger())
4644
}
45+
l := hclog.L().Named("netkeys")
4746

4847
c, err := netauth.New()
4948
if err != nil {
50-
log.Println("Error during client initialization:", err)
49+
l.Warn("Error during client initialization:", "error", err)
5150
os.Exit(1)
5251
}
5352

@@ -56,7 +55,7 @@ func main() {
5655

5756
e, err := c.EntityInfo(context.Background(), *entityID)
5857
if err != nil {
59-
log.Println("Error loading entity:", err)
58+
l.Error("Error loading entity:", "error", err)
6059
os.Exit(1)
6160
}
6261
if e.GetMeta().GetLocked() {

0 commit comments

Comments
 (0)