From cf2dc37a42986a6f0fb8e65d29d585acdb138f00 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 23 Nov 2020 14:22:32 +0300 Subject: [PATCH] [#195] object/put: Add option to set logger Signed-off-by: Leonard Lyubich --- cmd/neofs-node/object.go | 1 + pkg/services/object/put/service.go | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index 2c4cf8986..a03e84980 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -257,6 +257,7 @@ func initObjectService(c *cfg) { ), putsvc.WithNetworkState(c.cfgNetmap.state), putsvc.WithWorkerPool(c.cfgObject.pool.put), + putsvc.WithLogger(c.log), ) sPutV2 := putsvcV2.NewService( diff --git a/pkg/services/object/put/service.go b/pkg/services/object/put/service.go index b238df546..4bf954296 100644 --- a/pkg/services/object/put/service.go +++ b/pkg/services/object/put/service.go @@ -11,6 +11,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 MaxSizeSource interface { @@ -49,11 +51,14 @@ type cfg struct { networkState netmap.State clientCache *cache.ClientCache + + log *logger.Logger } func defaultCfg() *cfg { return &cfg{ workerPool: new(util.SyncWorkerPool), + log: zap.L(), } } @@ -137,3 +142,9 @@ func WithClientCache(v *cache.ClientCache) Option { c.clientCache = v } } + +func WithLogger(l *logger.Logger) Option { + return func(c *cfg) { + c.log = l + } +}