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

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
remotes/KirillovDenis/release/v0.21.1
Leonard Lyubich 2020-11-23 14:22:32 +03:00 committed by Alex Vanin
parent 9fbfc0b5e4
commit cf2dc37a42
2 changed files with 12 additions and 0 deletions

View File

@ -257,6 +257,7 @@ func initObjectService(c *cfg) {
),
putsvc.WithNetworkState(c.cfgNetmap.state),
putsvc.WithWorkerPool(c.cfgObject.pool.put),
putsvc.WithLogger(c.log),
)
sPutV2 := putsvcV2.NewService(

View File

@ -11,6 +11,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 MaxSizeSource interface {
@ -49,11 +51,14 @@ type cfg struct {
networkState netmap.State
clientCache *cache.ClientCache
log *logger.Logger
}
func defaultCfg() *cfg {
return &cfg{
workerPool: new(util.SyncWorkerPool),
log: zap.L(),
}
}
@ -137,3 +142,9 @@ func WithClientCache(v *cache.ClientCache) Option {
c.clientCache = v
}
}
func WithLogger(l *logger.Logger) Option {
return func(c *cfg) {
c.log = l
}
}