From ee6bb31e2e06b0b25d44f2cc942efe255c5c4490 Mon Sep 17 00:00:00 2001 From: jules01 Date: Fri, 24 Mar 2023 11:10:07 +0200 Subject: [PATCH] - fixed log print on getNodeFromDB error --- trie/node.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/trie/node.go b/trie/node.go index e248733f6d4..fd229363a24 100644 --- a/trie/node.go +++ b/trie/node.go @@ -13,6 +13,7 @@ import ( "github.com/multiversx/mx-chain-go/common" "github.com/multiversx/mx-chain-go/errors" "github.com/multiversx/mx-chain-go/trie/keyBuilder" + logger "github.com/multiversx/mx-chain-logger-go" ) const ( @@ -120,7 +121,12 @@ func computeAndSetNodeHash(n node) ([]byte, error) { func getNodeFromDBAndDecode(n []byte, db common.DBWriteCacher, marshalizer marshal.Marshalizer, hasher hashing.Hasher) (node, error) { encChild, err := db.Get(n) if err != nil { - log.Warn(common.GetNodeFromDBErrorString, "error", err, "key", n, "stack trace", string(debug.Stack())) + logLevel := logger.LogWarning + if errors.IsClosingError(err) { + logLevel = logger.LogTrace + } + + log.Log(logLevel, common.GetNodeFromDBErrorString, "error", err, "key", n, "stack trace", string(debug.Stack())) return nil, fmt.Errorf(common.GetNodeFromDBErrorString+" %w for key %v", err, hex.EncodeToString(n)) }