[#195] object/delete: Add option to set logger

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-23 14:19:49 +03:00 committed by Alex Vanin
parent ea36789b51
commit e1e5a590e9
2 changed files with 14 additions and 1 deletions

View file

@ -339,6 +339,7 @@ func initObjectService(c *cfg) {
deletesvc.WithLinkingHeader(
headsvc.NewRelationHeader(searchsvc.NewLinkingSearcher(sSearch), sHead),
),
deletesvc.WithLogger(c.log),
)
sDeleteV2 := deletesvcV2.NewService(

View file

@ -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
}
}