Get rid of logrus, it's TTY output is not friendly or human parseable if we will want users to send us logs.

This commit is contained in:
Eugene Bujak
2018-12-29 14:55:35 +03:00
parent a7e0f66492
commit 55a7ff7447
7 changed files with 9 additions and 13 deletions

View File

@@ -3,6 +3,7 @@ package dnsforward
import (
"errors"
"fmt"
"log"
"net"
"strings"
"sync"
@@ -13,7 +14,6 @@ import (
"github.com/AdguardTeam/dnsproxy/upstream"
"github.com/joomcode/errorx"
"github.com/miekg/dns"
log "github.com/sirupsen/logrus"
)
// DefaultTimeout is the default upstream timeout
@@ -283,7 +283,7 @@ func (s *Server) filterDNSRequest(d *proxy.DNSContext) (*dnsfilter.Result, error
// Return immediately if there's an error
return nil, errorx.Decorate(err, "dnsfilter failed to check host '%s'", host)
} else if res.IsFiltered {
log.Debugf("Host %s is filtered, reason - '%s', matched rule: '%s'", host, res.Reason, res.Rule)
// trace("Host %s is filtered, reason - '%s', matched rule: '%s'", host, res.Reason, res.Rule)
d.Res = s.genDNSFilterMessage(d, &res)
}
@@ -324,7 +324,7 @@ func (s *Server) genARecord(request *dns.Msg, ip net.IP) *dns.Msg {
resp.SetReply(request)
answer, err := dns.NewRR(fmt.Sprintf("%s %d A %s", request.Question[0].Name, s.BlockedResponseTTL, ip.String()))
if err != nil {
log.Warnf("Couldn't generate A record for up replacement host '%s': %s", ip.String(), err)
log.Printf("Couldn't generate A record for replacement host '%s': %s", ip.String(), err)
return s.genServerFailure(request)
}
resp.Answer = append(resp.Answer, answer)

View File

@@ -3,6 +3,7 @@ package dnsforward
import (
"encoding/json"
"fmt"
"log"
"net"
"net/http"
"strconv"
@@ -12,7 +13,6 @@ import (
"github.com/AdguardTeam/AdGuardHome/dnsfilter"
"github.com/miekg/dns"
log "github.com/sirupsen/logrus"
)
const (

View File

@@ -5,12 +5,11 @@ import (
"compress/gzip"
"encoding/json"
"fmt"
"log"
"os"
"sync"
"time"
log "github.com/sirupsen/logrus"
"github.com/go-test/deep"
)

View File

@@ -3,6 +3,7 @@ package dnsforward
import (
"bytes"
"fmt"
"log"
"net/http"
"os"
"path"
@@ -13,8 +14,6 @@ import (
"sync"
"time"
log "github.com/sirupsen/logrus"
"github.com/bluele/gcache"
"github.com/miekg/dns"
)

View File

@@ -3,12 +3,11 @@ package dnsforward
import (
"encoding/json"
"fmt"
"log"
"net/http"
"sync"
"time"
log "github.com/sirupsen/logrus"
"github.com/AdguardTeam/AdGuardHome/dnsfilter"
)