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

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-23 14:25:57 +03:00 committed by Alex Vanin
parent cb46e4b154
commit 6a5c37d592
2 changed files with 12 additions and 0 deletions

View file

@ -272,6 +272,7 @@ func initObjectService(c *cfg) {
searchsvc.WithNetworkMapSource(c.cfgObject.netMapStorage),
searchsvc.WithLocalAddressSource(c),
searchsvc.WithWorkerPool(c.cfgObject.pool.search),
searchsvc.WithLogger(c.log),
)
sSearchV2 := searchsvcV2.NewService(

View file

@ -12,6 +12,8 @@ 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"
"go.uber.org/zap"
)
type Service struct {
@ -34,11 +36,14 @@ type cfg struct {
localAddrSrc network.LocalAddressSource
clientCache *cache.ClientCache
log *logger.Logger
}
func defaultCfg() *cfg {
return &cfg{
workerPool: new(util.SyncWorkerPool),
log: zap.L(),
}
}
@ -105,3 +110,9 @@ func WithClientCache(v *cache.ClientCache) Option {
c.clientCache = v
}
}
func WithLogger(l *logger.Logger) Option {
return func(c *cfg) {
c.log = l
}
}