forked from TrueCloudLab/frostfs-node
[#240] logs: Move log messages to constants
Drop duplicate entities. Format entities. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com> Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
d29b13454f
commit
0e31c12e63
149 changed files with 1481 additions and 687 deletions
|
@ -8,6 +8,7 @@ import (
|
|||
"strings"
|
||||
"sync"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard"
|
||||
"go.uber.org/zap"
|
||||
|
@ -47,7 +48,7 @@ func (e *StorageEngine) open() error {
|
|||
|
||||
for res := range errCh {
|
||||
if res.err != nil {
|
||||
e.log.Error("could not open shard, closing and skipping",
|
||||
e.log.Error(logs.EngineCouldNotOpenShardClosingAndSkipping,
|
||||
zap.String("id", res.id),
|
||||
zap.Error(res.err))
|
||||
|
||||
|
@ -56,7 +57,7 @@ func (e *StorageEngine) open() error {
|
|||
|
||||
err := sh.Close()
|
||||
if err != nil {
|
||||
e.log.Error("could not close partially initialized shard",
|
||||
e.log.Error(logs.EngineCouldNotClosePartiallyInitializedShard,
|
||||
zap.String("id", res.id),
|
||||
zap.Error(res.err))
|
||||
}
|
||||
|
@ -94,7 +95,7 @@ func (e *StorageEngine) Init(ctx context.Context) error {
|
|||
for res := range errCh {
|
||||
if res.err != nil {
|
||||
if errors.Is(res.err, blobstor.ErrInitBlobovniczas) {
|
||||
e.log.Error("could not initialize shard, closing and skipping",
|
||||
e.log.Error(logs.EngineCouldNotInitializeShardClosingAndSkipping,
|
||||
zap.String("id", res.id),
|
||||
zap.Error(res.err))
|
||||
|
||||
|
@ -103,7 +104,7 @@ func (e *StorageEngine) Init(ctx context.Context) error {
|
|||
|
||||
err := sh.Close()
|
||||
if err != nil {
|
||||
e.log.Error("could not close partially initialized shard",
|
||||
e.log.Error(logs.EngineCouldNotClosePartiallyInitializedShard,
|
||||
zap.String("id", res.id),
|
||||
zap.Error(res.err))
|
||||
}
|
||||
|
@ -149,7 +150,7 @@ func (e *StorageEngine) close(releasePools bool) error {
|
|||
|
||||
for id, sh := range e.shards {
|
||||
if err := sh.Close(); err != nil {
|
||||
e.log.Debug("could not close shard",
|
||||
e.log.Debug(logs.EngineCouldNotCloseShard,
|
||||
zap.String("id", id),
|
||||
zap.String("error", err.Error()),
|
||||
)
|
||||
|
@ -309,7 +310,7 @@ loop:
|
|||
for _, p := range shardsToReload {
|
||||
err := p.sh.Reload(p.opts...)
|
||||
if err != nil {
|
||||
e.log.Error("could not reload a shard",
|
||||
e.log.Error(logs.EngineCouldNotReloadAShard,
|
||||
zap.Stringer("shard id", p.sh.ID()),
|
||||
zap.Error(err))
|
||||
}
|
||||
|
@ -338,7 +339,7 @@ loop:
|
|||
return fmt.Errorf("could not add %s shard: %w", idStr, err)
|
||||
}
|
||||
|
||||
e.log.Info("added new shard", zap.String("id", idStr))
|
||||
e.log.Info(logs.EngineAddedNewShard, zap.String("id", idStr))
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue