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