From 0a8740b01d85c018f201c3ae94ad6fb71ac5240d Mon Sep 17 00:00:00 2001 From: Lyndsay Roger Date: Sun, 16 Aug 2015 13:26:38 +1200 Subject: [PATCH] Improve logging output --- crawler.go | 3 ++- server.go | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/crawler.go b/crawler.go index 54695af..980baf8 100644 --- a/crawler.go +++ b/crawler.go @@ -52,9 +52,10 @@ func crawlTwistee(tw *Twistee) { // no more to do so return which will shutdown the goroutine & call // the deffered cleanup if config.verbose { - log.Printf("debug - failed crawl: twistee %s newstatus: %v:%v\n", + log.Printf("debug - failed crawl: twistee %s failcount: %v newstatus: %v:%v\n", net.JoinHostPort(tw.na.IP.String(), strconv.Itoa(int(tw.na.Port))), + tw.connectFails, tw.status, tw.rating) } diff --git a/server.go b/server.go index 62b6e3f..71a6ad3 100644 --- a/server.go +++ b/server.go @@ -143,21 +143,25 @@ func handleDNSStd(w dns.ResponseWriter, r *dns.Msg) { }} m.SetReply(r) + var qtype string + switch r.Question[0].Qtype { case dns.TypeA: latest.mtx.RLock() m.Answer = getv4stdRR() latest.mtx.RUnlock() + qtype = "A" case dns.TypeAAAA: latest.mtx.RLock() m.Answer = getv6stdRR() latest.mtx.RUnlock() + qtype = "AAAA" default: // return no answer to all other queries } if config.verbose { - log.Printf("debug - standard port DNS response to ip: %s\n", w.RemoteAddr().String()) + log.Printf("debug - standard port DNS response to ip: %s Query Type: %s\n", w.RemoteAddr().String(), qtype) } // FIXME - add stats and query counts @@ -175,21 +179,25 @@ func handleDNSNon(w dns.ResponseWriter, r *dns.Msg) { }} m.SetReply(r) + var qtype string + switch r.Question[0].Qtype { case dns.TypeA: latest.mtx.RLock() m.Answer = getv4nonRR() latest.mtx.RUnlock() + qtype = "A" case dns.TypeAAAA: latest.mtx.RLock() m.Answer = getv6nonRR() latest.mtx.RUnlock() + qtype = "AAAA" default: // return no answer to all other queries } if config.verbose { - log.Printf("debug - non standard port DNS response to ip: %s\n", w.RemoteAddr().String()) + log.Printf("debug - non standard port DNS response to ip: %s Query Type: %s\n", w.RemoteAddr().String(), qtype) } // FIXME - add stats and query counts