forked from TrueCloudLab/frostfs-node
f037022a7a
Make it store its internal `zap.Logger`'s level. Also, make all the components to accept internal `logger.Logger` instead of `zap.Logger`; it will simplify future refactor. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
28 lines
492 B
Go
28 lines
492 B
Go
package loadcontroller
|
|
|
|
import (
|
|
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
// Option sets an optional parameter of Controller.
|
|
type Option func(*options)
|
|
|
|
type options struct {
|
|
log *logger.Logger
|
|
}
|
|
|
|
func defaultOpts() *options {
|
|
return &options{
|
|
log: &logger.Logger{Logger: zap.L()},
|
|
}
|
|
}
|
|
|
|
// WithLogger returns option to specify logging component.
|
|
func WithLogger(l *logger.Logger) Option {
|
|
return func(o *options) {
|
|
if l != nil {
|
|
o.log = l
|
|
}
|
|
}
|
|
}
|