aboutsummaryrefslogtreecommitdiffstats
path: root/core/state
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-04-04 18:40:11 +0800
committerobscuren <geffobscura@gmail.com>2015-04-04 18:40:11 +0800
commita0e44e3281fcef0913b172ed4cdb5283a8d4a46b (patch)
treee10b9ce906119e3810a15df66f433da678a2764e /core/state
parent60e097a5f4c10e9e869bd2b4b2814b766b409e18 (diff)
downloadgo-tangerine-a0e44e3281fcef0913b172ed4cdb5283a8d4a46b.tar.gz
go-tangerine-a0e44e3281fcef0913b172ed4cdb5283a8d4a46b.tar.zst
go-tangerine-a0e44e3281fcef0913b172ed4cdb5283a8d4a46b.zip
basic glog
Diffstat (limited to 'core/state')
-rw-r--r--core/state/state_object.go19
-rw-r--r--core/state/statedb.go4
2 files changed, 16 insertions, 7 deletions
diff --git a/core/state/state_object.go b/core/state/state_object.go
index a7c20722c..e44bf2cd6 100644
--- a/core/state/state_object.go
+++ b/core/state/state_object.go
@@ -7,6 +7,8 @@ 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/rlp"
"github.com/ethereum/go-ethereum/trie"
)
@@ -121,7 +123,10 @@ func NewStateObjectFromBytes(address common.Address, data []byte, db common.Data
func (self *StateObject) MarkForDeletion() {
self.remove = true
self.dirty = true
- statelogger.Debugf("%x: #%d %v X\n", self.Address(), self.nonce, self.balance)
+
+ if glog.V(logger.Debug) {
+ glog.Infof("%x: #%d %v X\n", self.Address(), self.nonce, self.balance)
+ }
}
func (c *StateObject) getAddr(addr common.Hash) *common.Value {
@@ -185,13 +190,17 @@ func (c *StateObject) GetInstr(pc *big.Int) *common.Value {
func (c *StateObject) AddBalance(amount *big.Int) {
c.SetBalance(new(big.Int).Add(c.balance, amount))
- statelogger.Debugf("%x: #%d %v (+ %v)\n", c.Address(), c.nonce, c.balance, amount)
+ if glog.V(logger.Debug) {
+ glog.Infof("%x: #%d %v (+ %v)\n", c.Address(), c.nonce, c.balance, amount)
+ }
}
func (c *StateObject) SubBalance(amount *big.Int) {
c.SetBalance(new(big.Int).Sub(c.balance, amount))
- statelogger.Debugf("%x: #%d %v (- %v)\n", c.Address(), c.nonce, c.balance, amount)
+ if glog.V(logger.Debug) {
+ glog.Infof("%x: #%d %v (- %v)\n", c.Address(), c.nonce, c.balance, amount)
+ }
}
func (c *StateObject) SetBalance(amount *big.Int) {
@@ -225,7 +234,9 @@ func (c *StateObject) ConvertGas(gas, price *big.Int) error {
func (self *StateObject) SetGasPool(gasLimit *big.Int) {
self.gasPool = new(big.Int).Set(gasLimit)
- statelogger.Debugf("%x: gas (+ %v)", self.Address(), self.gasPool)
+ if glog.V(logger.Debug) {
+ glog.Infof("%x: gas (+ %v)", self.Address(), self.gasPool)
+ }
}
func (self *StateObject) BuyGas(gas, price *big.Int) error {
diff --git a/core/state/statedb.go b/core/state/statedb.go
index 33e8c20e5..e027533aa 100644
--- a/core/state/statedb.go
+++ b/core/state/statedb.go
@@ -6,12 +6,10 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/logger"
+ "github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/trie"
- "github.com/golang/glog"
)
-var statelogger = logger.NewLogger("STATE")
-
// StateDBs within the ethereum protocol are used to store anything
// within the merkle trie. StateDBs take care of caching and storing
// nested states. It's the general query interface to retrieve: