aboutsummaryrefslogtreecommitdiffstats
path: root/trie
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-02-22 20:10:07 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-02-23 18:16:44 +0800
commitd4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851 (patch)
tree17c93170551d3eeabe2935de1765f157007f0dc2 /trie
parent47af53f9aaf9aa7b12cd976eb150ccf3d64da6fd (diff)
downloaddexon-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.gz
dexon-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.zst
dexon-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.zip
all: blidly swap out glog to our log15, logs need rework
Diffstat (limited to 'trie')
-rw-r--r--trie/proof.go7
-rw-r--r--trie/secure_trie.go17
-rw-r--r--trie/trie.go15
3 files changed, 18 insertions, 21 deletions
diff --git a/trie/proof.go b/trie/proof.go
index bea5e5c09..06cf827ab 100644
--- a/trie/proof.go
+++ b/trie/proof.go
@@ -23,8 +23,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto/sha3"
- "github.com/ethereum/go-ethereum/logger"
- "github.com/ethereum/go-ethereum/logger/glog"
+ "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rlp"
)
@@ -61,9 +60,7 @@ func (t *Trie) Prove(key []byte) []rlp.RawValue {
var err error
tn, err = t.resolveHash(n, nil, nil)
if err != nil {
- if glog.V(logger.Error) {
- glog.Errorf("Unhandled trie error: %v", err)
- }
+ log.Error(fmt.Sprintf("Unhandled trie error: %v", err))
return nil
}
default:
diff --git a/trie/secure_trie.go b/trie/secure_trie.go
index 8b90da02f..113fb6a1a 100644
--- a/trie/secure_trie.go
+++ b/trie/secure_trie.go
@@ -17,9 +17,10 @@
package trie
import (
+ "fmt"
+
"github.com/ethereum/go-ethereum/common"
- "github.com/ethereum/go-ethereum/logger"
- "github.com/ethereum/go-ethereum/logger/glog"
+ "github.com/ethereum/go-ethereum/log"
)
var secureKeyPrefix = []byte("secure-key-")
@@ -70,8 +71,8 @@ func NewSecure(root common.Hash, db Database, cachelimit uint16) (*SecureTrie, e
// The value bytes must not be modified by the caller.
func (t *SecureTrie) Get(key []byte) []byte {
res, err := t.TryGet(key)
- if err != nil && glog.V(logger.Error) {
- glog.Errorf("Unhandled trie error: %v", err)
+ if err != nil {
+ log.Error(fmt.Sprintf("Unhandled trie error: %v", err))
}
return res
}
@@ -90,8 +91,8 @@ func (t *SecureTrie) TryGet(key []byte) ([]byte, error) {
// The value bytes must not be modified by the caller while they are
// stored in the trie.
func (t *SecureTrie) Update(key, value []byte) {
- if err := t.TryUpdate(key, value); err != nil && glog.V(logger.Error) {
- glog.Errorf("Unhandled trie error: %v", err)
+ if err := t.TryUpdate(key, value); err != nil {
+ log.Error(fmt.Sprintf("Unhandled trie error: %v", err))
}
}
@@ -115,8 +116,8 @@ func (t *SecureTrie) TryUpdate(key, value []byte) error {
// Delete removes any existing value for key from the trie.
func (t *SecureTrie) Delete(key []byte) {
- if err := t.TryDelete(key); err != nil && glog.V(logger.Error) {
- glog.Errorf("Unhandled trie error: %v", err)
+ if err := t.TryDelete(key); err != nil {
+ log.Error(fmt.Sprintf("Unhandled trie error: %v", err))
}
}
diff --git a/trie/trie.go b/trie/trie.go
index cd9e20cac..2a6044068 100644
--- a/trie/trie.go
+++ b/trie/trie.go
@@ -23,8 +23,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto/sha3"
- "github.com/ethereum/go-ethereum/logger"
- "github.com/ethereum/go-ethereum/logger/glog"
+ "github.com/ethereum/go-ethereum/log"
"github.com/rcrowley/go-metrics"
)
@@ -135,8 +134,8 @@ func (t *Trie) Iterator() *Iterator {
// The value bytes must not be modified by the caller.
func (t *Trie) Get(key []byte) []byte {
res, err := t.TryGet(key)
- if err != nil && glog.V(logger.Error) {
- glog.Errorf("Unhandled trie error: %v", err)
+ if err != nil {
+ log.Error(fmt.Sprintf("Unhandled trie error: %v", err))
}
return res
}
@@ -198,8 +197,8 @@ func (t *Trie) tryGet(origNode node, key []byte, pos int) (value []byte, newnode
// The value bytes must not be modified by the caller while they are
// stored in the trie.
func (t *Trie) Update(key, value []byte) {
- if err := t.TryUpdate(key, value); err != nil && glog.V(logger.Error) {
- glog.Errorf("Unhandled trie error: %v", err)
+ if err := t.TryUpdate(key, value); err != nil {
+ log.Error(fmt.Sprintf("Unhandled trie error: %v", err))
}
}
@@ -300,8 +299,8 @@ func (t *Trie) insert(n node, prefix, key []byte, value node) (bool, node, error
// Delete removes any existing value for key from the trie.
func (t *Trie) Delete(key []byte) {
- if err := t.TryDelete(key); err != nil && glog.V(logger.Error) {
- glog.Errorf("Unhandled trie error: %v", err)
+ if err := t.TryDelete(key); err != nil {
+ log.Error(fmt.Sprintf("Unhandled trie error: %v", err))
}
}