From e1e5a590e960b26e845ddd19bfa0fef53c89ec6f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 23 Nov 2020 14:19:49 +0300 Subject: [PATCH] [#195] object/delete: Add option to set logger Signed-off-by: Leonard Lyubich --- cmd/neofs-node/object.go | 1 + pkg/services/object/delete/service.go | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index 2a0367ca4..d5c1d3375 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -339,6 +339,7 @@ func initObjectService(c *cfg) { deletesvc.WithLinkingHeader( headsvc.NewRelationHeader(searchsvc.NewLinkingSearcher(sSearch), sHead), ), + deletesvc.WithLogger(c.log), ) sDeleteV2 := deletesvcV2.NewService( diff --git a/pkg/services/object/delete/service.go b/pkg/services/object/delete/service.go index b2175cb4b..5f812b29b 100644 --- a/pkg/services/object/delete/service.go +++ b/pkg/services/object/delete/service.go @@ -10,7 +10,9 @@ import ( putsvc "github.com/nspcc-dev/neofs-node/pkg/services/object/put" objutil "github.com/nspcc-dev/neofs-node/pkg/services/object/util" "github.com/nspcc-dev/neofs-node/pkg/services/object_manager/placement" + "github.com/nspcc-dev/neofs-node/pkg/util/logger" "github.com/pkg/errors" + "go.uber.org/zap" ) type Service struct { @@ -33,10 +35,14 @@ type cfg struct { headSvc *headsvc.Service hdrLinking RelationHeader + + log *logger.Logger } func defaultCfg() *cfg { - return new(cfg) + return &cfg{ + log: zap.L(), + } } func NewService(opts ...Option) *Service { @@ -189,3 +195,9 @@ func WithLinkingHeader(v RelationHeader) Option { c.hdrLinking = v } } + +func WithLogger(l *logger.Logger) Option { + return func(c *cfg) { + c.log = l + } +}