diff --git a/cli.go b/cli.go index f59b880..3142f38 100644 --- a/cli.go +++ b/cli.go @@ -133,6 +133,10 @@ func prepareCLI() *cli.App { Aliases: []string{"x"}, Usage: "do a reverse lookup", }, + &cli.BoolFlag{ + Name: "debug", + Usage: "enable debug logging", + }, }, Action: doQuery, } diff --git a/query.go b/query.go index 57753b5..7dc3831 100644 --- a/query.go +++ b/query.go @@ -8,6 +8,7 @@ import ( "strings" "time" + "git.froth.zone/sam/awl/logawl" "git.froth.zone/sam/awl/query" "git.froth.zone/sam/awl/util" "github.com/miekg/dns" @@ -26,6 +27,11 @@ func doQuery(c *cli.Context) error { return err } + logger := logawl.New() //init logger + if c.Bool("debug") { + logger.SetLevel(3) //set level to debug + } + port := c.Int("port") // If port is not set, set it