[#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:
Pavel Karpy 2022-09-28 10:41:01 +03:00 committed by Pavel Karpy
parent 4baf00aa21
commit f037022a7a
83 changed files with 207 additions and 156 deletions

View file

@ -6,6 +6,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/common"
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
"go.uber.org/zap"
)
@ -27,7 +28,7 @@ type blob interface {
}
type options struct {
log *zap.Logger
log *logger.Logger
// path is a path to a directory for write-cache.
path string
// blobstor is the main persistent storage.
@ -52,9 +53,9 @@ type options struct {
}
// WithLogger sets logger.
func WithLogger(log *zap.Logger) Option {
func WithLogger(log *logger.Logger) Option {
return func(o *options) {
o.log = log.With(zap.String("component", "WriteCache"))
o.log = &logger.Logger{Logger: log.With(zap.String("component", "WriteCache"))}
}
}