Added debuge flag, and added init for logawl

This commit is contained in:
grumbulon 2022-06-28 12:12:52 -04:00
parent d4b8d1469f
commit a36f1b8685
2 changed files with 10 additions and 0 deletions

4
cli.go
View file

@ -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,
}

View file

@ -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