[#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.WithNetworkState(c.cfgNetmap.state),
putsvc.WithWorkerPool(c.cfgObject.pool.put), putsvc.WithWorkerPool(c.cfgObject.pool.put),
putsvc.WithLogger(c.log),
) )
sPutV2 := putsvcV2.NewService( sPutV2 := putsvcV2.NewService(

View File

@ -11,6 +11,8 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/network/cache" "github.com/nspcc-dev/neofs-node/pkg/network/cache"
objutil "github.com/nspcc-dev/neofs-node/pkg/services/object/util" 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"
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
"go.uber.org/zap"
) )
type MaxSizeSource interface { type MaxSizeSource interface {
@ -49,11 +51,14 @@ type cfg struct {
networkState netmap.State networkState netmap.State
clientCache *cache.ClientCache clientCache *cache.ClientCache
log *logger.Logger
} }
func defaultCfg() *cfg { func defaultCfg() *cfg {
return &cfg{ return &cfg{
workerPool: new(util.SyncWorkerPool), workerPool: new(util.SyncWorkerPool),
log: zap.L(),
} }
} }
@ -137,3 +142,9 @@ func WithClientCache(v *cache.ClientCache) Option {
c.clientCache = v c.clientCache = v
} }
} }
func WithLogger(l *logger.Logger) Option {
return func(c *cfg) {
c.log = l
}
}