[#1759] services/tree: Make logs more descriptive

Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
Evgenii Stratonikov 2022-09-07 10:25:03 +03:00 committed by LeL
parent 74c861342e
commit 0140ac354b
2 changed files with 15 additions and 6 deletions

View file

@ -4,6 +4,7 @@ import (
"context"
"crypto/sha256"
"encoding/hex"
"errors"
"fmt"
"time"
@ -56,10 +57,15 @@ func (s *Service) replicationWorker() {
})
if lastErr != nil {
s.log.Warn("failed to sent update to the node",
zap.String("last_error", lastErr.Error()),
zap.String("address", lastAddr),
zap.String("key", hex.EncodeToString(task.n.PublicKey())))
if errors.Is(lastErr, errRecentlyFailed) {
s.log.Debug("do not send update to the node",
zap.String("last_error", lastErr.Error()))
} else {
s.log.Warn("failed to sent update to the node",
zap.String("last_error", lastErr.Error()),
zap.String("address", lastAddr),
zap.String("key", hex.EncodeToString(task.n.PublicKey())))
}
}
}
}