Added debuge flag, and added init for logawl
This commit is contained in:
parent
d4b8d1469f
commit
a36f1b8685
2 changed files with 10 additions and 0 deletions
4
cli.go
4
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,
|
||||
}
|
||||
|
|
6
query.go
6
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
|
||||
|
|
Loading…
Reference in a new issue