Pull request 2271: AGDNS-2374-slog-arpdb
Squashed commit of the following: commit 355136e6e2f3e77b483d97fbc01fbef562c319eb Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Aug 27 18:09:51 2024 +0300 arpdb: imp docs commit 27383833033216ab938b0896dbc39e5af8d4dde9 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Aug 26 19:11:10 2024 +0300 all: slog arpdb
This commit is contained in:
@@ -39,6 +39,7 @@ import (
|
||||
"github.com/AdguardTeam/golibs/errors"
|
||||
"github.com/AdguardTeam/golibs/hostsfile"
|
||||
"github.com/AdguardTeam/golibs/log"
|
||||
"github.com/AdguardTeam/golibs/logutil/slogutil"
|
||||
"github.com/AdguardTeam/golibs/netutil"
|
||||
"github.com/AdguardTeam/golibs/osutil"
|
||||
)
|
||||
@@ -276,7 +277,7 @@ func setupOpts(opts options) (err error) {
|
||||
}
|
||||
|
||||
// initContextClients initializes Context clients and related fields.
|
||||
func initContextClients() (err error) {
|
||||
func initContextClients(logger *slog.Logger) (err error) {
|
||||
err = setupDNSFilteringConf(config.Filtering)
|
||||
if err != nil {
|
||||
// Don't wrap the error, because it's informative enough as is.
|
||||
@@ -300,7 +301,7 @@ func initContextClients() (err error) {
|
||||
|
||||
var arpDB arpdb.Interface
|
||||
if config.Clients.Sources.ARP {
|
||||
arpDB = arpdb.New()
|
||||
arpDB = arpdb.New(logger.With(slogutil.KeyError, "arpdb"))
|
||||
}
|
||||
|
||||
return Context.clients.Init(
|
||||
@@ -582,7 +583,7 @@ func run(opts options, clientBuildFS fs.FS, done chan struct{}) {
|
||||
// data first, but also to avoid relying on automatic Go init() function.
|
||||
filtering.InitModule()
|
||||
|
||||
err = initContextClients()
|
||||
err = initContextClients(slogLogger)
|
||||
fatalOnError(err)
|
||||
|
||||
err = setupOpts(opts)
|
||||
|
||||
Reference in New Issue
Block a user