aboutsummaryrefslogtreecommitdiffstats
path: root/core/state
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 /core/state
parent47af53f9aaf9aa7b12cd976eb150ccf3d64da6fd (diff)
downloadgo-tangerine-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.gz
go-tangerine-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.zst
go-tangerine-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.zip
all: blidly swap out glog to our log15, logs need rework
Diffstat (limited to 'core/state')
-rw-r--r--core/state/state_object.go21
-rw-r--r--core/state/statedb.go13
2 files changed, 16 insertions, 18 deletions
diff --git a/core/state/state_object.go b/core/state/state_object.go
index 4fb69b646..ebb103806 100644
--- a/core/state/state_object.go
+++ b/core/state/state_object.go
@@ -24,8 +24,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
- "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"
"github.com/ethereum/go-ethereum/trie"
)
@@ -135,9 +134,9 @@ func (self *stateObject) markSuicided() {
self.onDirty(self.Address())
self.onDirty = nil
}
- if glog.V(logger.Debug) {
- glog.Infof("%x: #%d %v X\n", self.Address(), self.Nonce(), self.Balance())
- }
+ log.Debug("", "msg", log.Lazy{Fn: func() string {
+ return fmt.Sprintf("%x: #%d %v X\n", self.Address(), self.Nonce(), self.Balance())
+ }})
}
func (c *stateObject) touch() {
@@ -253,9 +252,9 @@ func (c *stateObject) AddBalance(amount *big.Int) {
}
c.SetBalance(new(big.Int).Add(c.Balance(), amount))
- if glog.V(logger.Debug) {
- glog.Infof("%x: #%d %v (+ %v)\n", c.Address(), c.Nonce(), c.Balance(), amount)
- }
+ log.Debug("", "msg", log.Lazy{Fn: func() string {
+ return fmt.Sprintf("%x: #%d %v (+ %v)\n", c.Address(), c.Nonce(), c.Balance(), amount)
+ }})
}
// SubBalance removes amount from c's balance.
@@ -266,9 +265,9 @@ func (c *stateObject) SubBalance(amount *big.Int) {
}
c.SetBalance(new(big.Int).Sub(c.Balance(), amount))
- if glog.V(logger.Debug) {
- glog.Infof("%x: #%d %v (- %v)\n", c.Address(), c.Nonce(), c.Balance(), amount)
- }
+ log.Debug("", "msg", log.Lazy{Fn: func() string {
+ return fmt.Sprintf("%x: #%d %v (- %v)\n", c.Address(), c.Nonce(), c.Balance(), amount)
+ }})
}
func (self *stateObject) SetBalance(amount *big.Int) {
diff --git a/core/state/statedb.go b/core/state/statedb.go
index cae2dc4b2..a87607a25 100644
--- a/core/state/statedb.go
+++ b/core/state/statedb.go
@@ -27,8 +27,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethdb"
- "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"
"github.com/ethereum/go-ethereum/trie"
lru "github.com/hashicorp/golang-lru"
@@ -411,7 +410,7 @@ func (self *StateDB) getStateObject(addr common.Address) (stateObject *stateObje
}
var data Account
if err := rlp.DecodeBytes(enc, &data); err != nil {
- glog.Errorf("can't decode object at %x: %v", addr[:], err)
+ log.Error(fmt.Sprintf("can't decode object at %x: %v", addr[:], err))
return nil
}
// Insert into the live set.
@@ -446,9 +445,9 @@ func (self *StateDB) createObject(addr common.Address) (newobj, prev *stateObjec
newobj = newObject(self, addr, Account{}, self.MarkStateObjectDirty)
newobj.setNonce(0) // sets the object to dirty
if prev == nil {
- if glog.V(logger.Debug) {
- glog.Infof("(+) %x\n", addr)
- }
+ log.Debug("", "msg", log.Lazy{Fn: func() string {
+ return fmt.Sprintf("(+) %x\n", addr)
+ }})
self.journal = append(self.journal, createObjectChange{account: &addr})
} else {
self.journal = append(self.journal, resetObjectChange{prev: prev})
@@ -617,7 +616,7 @@ func (s *StateDB) CommitBatch(deleteEmptyObjects bool) (root common.Hash, batch
batch = s.db.NewBatch()
root, _ = s.commit(batch, deleteEmptyObjects)
- glog.V(logger.Debug).Infof("Trie cache stats: %d misses, %d unloads", trie.CacheMisses(), trie.CacheUnloads())
+ log.Debug(fmt.Sprintf("Trie cache stats: %d misses, %d unloads", trie.CacheMisses(), trie.CacheUnloads()))
return root, batch
}