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
|
@ -289,7 +289,7 @@ type internals struct {
|
|||
|
||||
appCfg *config.Config
|
||||
|
||||
log *zap.Logger
|
||||
log *logger.Logger
|
||||
|
||||
wg *sync.WaitGroup
|
||||
workers []worker
|
||||
|
|
|
@ -92,7 +92,7 @@ func serveGRPC(c *cfg) {
|
|||
}
|
||||
|
||||
func stopGRPC(name string, s *grpc.Server, l *logger.Logger) {
|
||||
l = l.With(zap.String("name", name))
|
||||
l = &logger.Logger{Logger: l.With(zap.String("name", name))}
|
||||
|
||||
l.Info("stopping gRPC server...")
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import (
|
|||
"github.com/nspcc-dev/neofs-node/pkg/morph/event/netmap"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/notificator"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/notificator/nats"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
|
||||
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
|
||||
oid "github.com/nspcc-dev/neofs-sdk-go/object/id"
|
||||
"go.uber.org/zap"
|
||||
|
@ -17,7 +18,7 @@ import (
|
|||
|
||||
type notificationSource struct {
|
||||
e *engine.StorageEngine
|
||||
l *zap.Logger
|
||||
l *logger.Logger
|
||||
defaultTopic string
|
||||
}
|
||||
|
||||
|
@ -92,7 +93,7 @@ func (n *notificationSource) processAddress(
|
|||
}
|
||||
|
||||
type notificationWriter struct {
|
||||
l *zap.Logger
|
||||
l *logger.Logger
|
||||
w *nats.Writer
|
||||
}
|
||||
|
||||
|
|
|
@ -60,8 +60,8 @@ func initReputationService(c *cfg) {
|
|||
Storage: consumerStorage,
|
||||
}
|
||||
|
||||
localTrustLogger := c.log.With(zap.String("trust_type", "local"))
|
||||
intermediateTrustLogger := c.log.With(zap.String("trust_type", "intermediate"))
|
||||
localTrustLogger := &logger.Logger{Logger: c.log.With(zap.String("trust_type", "local"))}
|
||||
intermediateTrustLogger := &logger.Logger{Logger: c.log.With(zap.String("trust_type", "intermediate"))}
|
||||
|
||||
localTrustStorage := &localreputation.TrustStorage{
|
||||
Log: localTrustLogger,
|
||||
|
|
|
@ -133,7 +133,7 @@ type FinalWriterOption func(*finalWriterOptions)
|
|||
|
||||
func defaultFinalWriterOptionsOpts() *finalWriterOptions {
|
||||
return &finalWriterOptions{
|
||||
log: zap.L(),
|
||||
log: &logger.Logger{Logger: zap.L()},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue