[#195] object/range: Add option to set logger
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
cf2dc37a42
commit
af6484e3b1
2 changed files with 12 additions and 0 deletions
|
@ -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(
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue