forked from TrueCloudLab/frostfs-node
[#195] object/rangehash: Add option to set logger
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
af6484e3b1
commit
cb46e4b154
2 changed files with 12 additions and 0 deletions
|
@ -328,6 +328,7 @@ func initObjectService(c *cfg) {
|
|||
rangehashsvc.WithHeadService(sHead),
|
||||
rangehashsvc.WithRangeService(sRange),
|
||||
rangehashsvc.WithWorkerPool(c.cfgObject.pool.rngHash),
|
||||
rangehashsvc.WithLogger(c.log),
|
||||
)
|
||||
|
||||
sRangeHashV2 := rangehashsvcV2.NewService(
|
||||
|
|
|
@ -17,7 +17,9 @@ import (
|
|||
rangesvc "github.com/nspcc-dev/neofs-node/pkg/services/object/range"
|
||||
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 {
|
||||
|
@ -44,11 +46,14 @@ type cfg struct {
|
|||
rangeSvc *rangesvc.Service
|
||||
|
||||
clientCache *cache.ClientCache
|
||||
|
||||
log *logger.Logger
|
||||
}
|
||||
|
||||
func defaultCfg() *cfg {
|
||||
return &cfg{
|
||||
workerPool: new(util.SyncWorkerPool),
|
||||
log: zap.L(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -273,3 +278,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