move from logrus to slog (#422)

* Migrate from logrus to slog

* fully removing logrus

* should be working now

* Update pipeline.go

Co-authored-by: Frank Olbricht <frank.olbricht@gmail.com>

* Update response-blocklist-name.go

Co-authored-by: Frank Olbricht <frank.olbricht@gmail.com>

* added null logger

* Update pipeline.go

---------

Co-authored-by: Frank Olbricht <frank.olbricht@gmail.com>
This commit is contained in:
Ali
2025-01-13 20:43:30 +13:00
committed by GitHub
parent 8cb29b5b1f
commit e51f51e1bc
45 changed files with 361 additions and 285 deletions

View File

@@ -6,8 +6,9 @@ import (
"strings"
"time"
"log/slog"
"github.com/miekg/dns"
"github.com/sirupsen/logrus"
)
// DNSClient represents a simple DNS resolver for UDP or TCP.
@@ -65,11 +66,11 @@ func NewDNSClient(id, endpoint, network string, opt DNSClientOptions) (*DNSClien
func (d *DNSClient) Resolve(q *dns.Msg, ci ClientInfo) (*dns.Msg, error) {
// Packing a message is not always a read-only operation, make a copy
q = q.Copy()
logger(d.id, q, ci).WithFields(logrus.Fields{
"resolver": d.endpoint,
"protocol": d.net,
}).Debug("querying upstream resolver")
log := logger(d.id, q, ci)
log.Debug("querying upstream resolver",
slog.String("resolver", d.endpoint),
slog.String("protocol", d.net),
)
q = setUDPSize(q, d.opt.UDPSize)