forked from TrueCloudLab/frostfs-node
[#195] object/head: Add option to set logger
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
e1e5a590e9
commit
9fbfc0b5e4
2 changed files with 12 additions and 0 deletions
|
@ -286,6 +286,7 @@ func initObjectService(c *cfg) {
|
|||
headsvc.WithLocalAddressSource(c),
|
||||
headsvc.WithRightChildSearcher(searchsvc.NewRightChildSearcher(sSearch)),
|
||||
headsvc.WithWorkerPool(c.cfgObject.pool.head),
|
||||
headsvc.WithLogger(c.log),
|
||||
)
|
||||
|
||||
sHeadV2 := headsvcV2.NewService(
|
||||
|
|
|
@ -11,7 +11,9 @@ 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"
|
||||
"github.com/pkg/errors"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type RelationSearcher interface {
|
||||
|
@ -38,6 +40,8 @@ type cfg struct {
|
|||
localHeader localHeader
|
||||
|
||||
remoteHeader RemoteHeader
|
||||
|
||||
log *logger.Logger
|
||||
}
|
||||
|
||||
var ErrNotFound = errors.New("object header not found")
|
||||
|
@ -45,6 +49,7 @@ var ErrNotFound = errors.New("object header not found")
|
|||
func defaultCfg() *cfg {
|
||||
return &cfg{
|
||||
workerPool: new(util.SyncWorkerPool),
|
||||
log: zap.L(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,3 +146,9 @@ func WithClientCache(v *cache.ClientCache) Option {
|
|||
c.remoteHeader.clientCache = v
|
||||
}
|
||||
}
|
||||
|
||||
func WithLogger(l *logger.Logger) Option {
|
||||
return func(c *cfg) {
|
||||
c.log = l
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue