From af6484e3b188f704bb23bc70ce06e921507ff87a Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 23 Nov 2020 14:23:58 +0300 Subject: [PATCH] [#195] object/range: Add option to set logger Signed-off-by: Leonard Lyubich --- cmd/neofs-node/object.go | 1 + pkg/services/object/range/service.go | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index a03e84980..b6b98c5c9 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -303,6 +303,7 @@ func initObjectService(c *cfg) { rangesvc.WithLocalAddressSource(c), rangesvc.WithWorkerPool(c.cfgObject.pool.rng), rangesvc.WithHeadService(sHead), + rangesvc.WithLogger(c.log), ) sRangeV2 := rangesvcV2.NewService( diff --git a/pkg/services/object/range/service.go b/pkg/services/object/range/service.go index 2cc7849a9..09c1806a4 100644 --- a/pkg/services/object/range/service.go +++ b/pkg/services/object/range/service.go @@ -13,7 +13,9 @@ import ( headsvc "github.com/nspcc-dev/neofs-node/pkg/services/object/head" 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" "github.com/pkg/errors" + "go.uber.org/zap" ) type Service struct { @@ -38,11 +40,14 @@ type cfg struct { headSvc *headsvc.Service clientCache *cache.ClientCache + + log *logger.Logger } func defaultCfg() *cfg { return &cfg{ workerPool: new(util.SyncWorkerPool), + log: zap.L(), } } @@ -173,3 +178,9 @@ func WithClientCache(v *cache.ClientCache) Option { c.clientCache = v } } + +func WithLogger(l *logger.Logger) Option { + return func(c *cfg) { + c.log = l + } +}