From 6a5c37d592e9c9560cba44077358d35032cf6178 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 23 Nov 2020 14:25:57 +0300 Subject: [PATCH] [#195] object/search: Add option to set logger Signed-off-by: Leonard Lyubich --- cmd/neofs-node/object.go | 1 + pkg/services/object/search/service.go | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index 60017c9a..85dd6d67 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -272,6 +272,7 @@ func initObjectService(c *cfg) { searchsvc.WithNetworkMapSource(c.cfgObject.netMapStorage), searchsvc.WithLocalAddressSource(c), searchsvc.WithWorkerPool(c.cfgObject.pool.search), + searchsvc.WithLogger(c.log), ) sSearchV2 := searchsvcV2.NewService( diff --git a/pkg/services/object/search/service.go b/pkg/services/object/search/service.go index b30994a8..26617533 100644 --- a/pkg/services/object/search/service.go +++ b/pkg/services/object/search/service.go @@ -12,6 +12,8 @@ import ( "github.com/nspcc-dev/neofs-node/pkg/network/cache" objutil "github.com/nspcc-dev/neofs-node/pkg/services/object/util" "github.com/nspcc-dev/neofs-node/pkg/util" + "github.com/nspcc-dev/neofs-node/pkg/util/logger" + "go.uber.org/zap" ) type Service struct { @@ -34,11 +36,14 @@ type cfg struct { localAddrSrc network.LocalAddressSource clientCache *cache.ClientCache + + log *logger.Logger } func defaultCfg() *cfg { return &cfg{ workerPool: new(util.SyncWorkerPool), + log: zap.L(), } } @@ -105,3 +110,9 @@ func WithClientCache(v *cache.ClientCache) Option { c.clientCache = v } } + +func WithLogger(l *logger.Logger) Option { + return func(c *cfg) { + c.log = l + } +}