diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-02-23 22:49:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-23 22:49:05 +0800 |
commit | 357732a8404c9fe4d02f041d20a0d05381a3e6d1 (patch) | |
tree | edaf8a63eb7f7434cd9b9cbd764b3c4c3d76191e /light/state_object.go | |
parent | 29fac7de448c85049a97cbec3dc0819122bd2cb0 (diff) | |
parent | f89dd627760b43bd405cb3db1e5efdb100835db5 (diff) | |
download | dexon-357732a8404c9fe4d02f041d20a0d05381a3e6d1.tar dexon-357732a8404c9fe4d02f041d20a0d05381a3e6d1.tar.gz dexon-357732a8404c9fe4d02f041d20a0d05381a3e6d1.tar.bz2 dexon-357732a8404c9fe4d02f041d20a0d05381a3e6d1.tar.lz dexon-357732a8404c9fe4d02f041d20a0d05381a3e6d1.tar.xz dexon-357732a8404c9fe4d02f041d20a0d05381a3e6d1.tar.zst dexon-357732a8404c9fe4d02f041d20a0d05381a3e6d1.zip |
Merge pull request #3696 from karalabe/contextual-logger
Contextual logger
Diffstat (limited to 'light/state_object.go')
-rw-r--r-- | light/state_object.go | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/light/state_object.go b/light/state_object.go index e876c1566..03d4868cd 100644 --- a/light/state_object.go +++ b/light/state_object.go @@ -23,8 +23,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" "golang.org/x/net/context" ) @@ -109,9 +108,9 @@ func (self *StateObject) MarkForDeletion() { self.remove = true self.dirty = true - 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) + }}) } // getAddr gets the storage value at the given address from the trie @@ -158,18 +157,18 @@ func (self *StateObject) SetState(k, value common.Hash) { 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 subtracts the given amount from the account balance 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) + }}) } // SetBalance sets the account balance to the given amount |