forked from TrueCloudLab/frostfs-node
[#1770] logger: Refactor Logger
component
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>
This commit is contained in:
parent
4baf00aa21
commit
f037022a7a
83 changed files with 207 additions and 156 deletions
|
@ -4,11 +4,12 @@ import (
|
|||
"crypto/ecdsa"
|
||||
"time"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type cfg struct {
|
||||
l *zap.Logger
|
||||
l *logger.Logger
|
||||
timeout time.Duration
|
||||
privateKey *ecdsa.PrivateKey
|
||||
}
|
||||
|
@ -18,14 +19,14 @@ type Option func(*cfg)
|
|||
|
||||
func defaultCfg() *cfg {
|
||||
return &cfg{
|
||||
l: zap.L(),
|
||||
l: &logger.Logger{Logger: zap.L()},
|
||||
timeout: 100 * time.Millisecond,
|
||||
}
|
||||
}
|
||||
|
||||
// WithLogger returns an option to specify
|
||||
// logger.
|
||||
func WithLogger(v *zap.Logger) Option {
|
||||
func WithLogger(v *logger.Logger) Option {
|
||||
return func(c *cfg) {
|
||||
c.l = v
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue