From a36f1b8685d07c0a1c48797dc3e4a2b80cce8300 Mon Sep 17 00:00:00 2001 From: grumbulon Date: Tue, 28 Jun 2022 12:12:52 -0400 Subject: [PATCH] Added debuge flag, and added init for logawl --- cli.go | 4 ++++ query.go | 6 ++++++ 2 files changed, 10 insertions(+) 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