From 00b4217aab916fad64be8fb101cc4127d5750683 Mon Sep 17 00:00:00 2001 From: loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com> Date: Sat, 22 Aug 2020 19:07:14 +0800 Subject: [PATCH] Fix: loging empty rules & DNS --- app/dns/server.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/dns/server.go b/app/dns/server.go index 7a0ba8e9d..22920e5bb 100644 --- a/app/dns/server.go +++ b/app/dns/server.go @@ -379,8 +379,12 @@ func (s *Server) lookupIPInternal(domain string, option IPOption) ([]net.IP, err domainRules = append(domainRules, fmt.Sprintf("%s(DNS idx:%d)", rule, info.clientIdx)) matchingDNS = append(matchingDNS, s.clients[info.clientIdx].Name()) } - newError("domain ", domain, " matching following rules: ", domainRules).AtDebug().WriteToLog() - newError("domain ", domain, " uses following DNS first: ", matchingDNS).AtDebug().WriteToLog() + if len(domainRules) > 0 { + newError("domain ", domain, " matches following rules: ", domainRules).AtDebug().WriteToLog() + } + if len(matchingDNS) > 0 { + newError("domain ", domain, " uses following DNS first: ", matchingDNS).AtDebug().WriteToLog() + } for _, idx := range indices { clientIdx := int(s.matcherInfos[idx].clientIdx) matchedClient = s.clients[clientIdx]