aboutsummaryrefslogtreecommitdiffstats
path: root/contracts
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 /contracts
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 'contracts')
-rw-r--r--contracts/chequebook/cheque.go23
-rw-r--r--contracts/release/release.go19
2 files changed, 20 insertions, 22 deletions
diff --git a/contracts/chequebook/cheque.go b/contracts/chequebook/cheque.go
index d49964f91..9a2a5a2a6 100644
--- a/contracts/chequebook/cheque.go
+++ b/contracts/chequebook/cheque.go
@@ -40,8 +40,7 @@ import (
"github.com/ethereum/go-ethereum/contracts/chequebook/contract"
"github.com/ethereum/go-ethereum/core/types"
"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/swarm/services/swap/swap"
"golang.org/x/net/context"
)
@@ -140,7 +139,7 @@ func NewChequebook(path string, contractAddr common.Address, prvKey *ecdsa.Priva
if (contractAddr != common.Address{}) {
self.setBalanceFromBlockChain()
- glog.V(logger.Detail).Infof("new chequebook initialised from %s (owner: %v, balance: %s)", contractAddr.Hex(), self.owner.Hex(), self.balance.String())
+ log.Trace(fmt.Sprintf("new chequebook initialised from %s (owner: %v, balance: %s)", contractAddr.Hex(), self.owner.Hex(), self.balance.String()))
}
return
}
@@ -148,7 +147,7 @@ func NewChequebook(path string, contractAddr common.Address, prvKey *ecdsa.Priva
func (self *Chequebook) setBalanceFromBlockChain() {
balance, err := self.backend.BalanceAt(context.TODO(), self.contractAddr, nil)
if err != nil {
- glog.V(logger.Error).Infof("can't get balance: %v", err)
+ log.Error(fmt.Sprintf("can't get balance: %v", err))
} else {
self.balance.Set(balance)
}
@@ -172,7 +171,7 @@ func LoadChequebook(path string, prvKey *ecdsa.PrivateKey, backend Backend, chec
self.setBalanceFromBlockChain()
}
- glog.V(logger.Detail).Infof("loaded chequebook (%s, owner: %v, balance: %v) initialised from %v", self.contractAddr.Hex(), self.owner.Hex(), self.balance, path)
+ log.Trace(fmt.Sprintf("loaded chequebook (%s, owner: %v, balance: %v) initialised from %v", self.contractAddr.Hex(), self.owner.Hex(), self.balance, path))
return
}
@@ -227,7 +226,7 @@ func (self *Chequebook) Save() (err error) {
if err != nil {
return err
}
- glog.V(logger.Detail).Infof("saving chequebook (%s) to %v", self.contractAddr.Hex(), self.path)
+ log.Trace(fmt.Sprintf("saving chequebook (%s) to %v", self.contractAddr.Hex(), self.path))
return ioutil.WriteFile(self.path, data, os.ModePerm)
}
@@ -340,12 +339,12 @@ func (self *Chequebook) deposit(amount *big.Int) (string, error) {
chbookRaw := &contract.ChequebookRaw{Contract: self.contract}
tx, err := chbookRaw.Transfer(depositTransactor)
if err != nil {
- glog.V(logger.Warn).Infof("error depositing %d wei to chequebook (%s, balance: %v, target: %v): %v", amount, self.contractAddr.Hex(), self.balance, self.buffer, err)
+ log.Warn(fmt.Sprintf("error depositing %d wei to chequebook (%s, balance: %v, target: %v): %v", amount, self.contractAddr.Hex(), self.balance, self.buffer, err))
return "", err
}
// assume that transaction is actually successful, we add the amount to balance right away
self.balance.Add(self.balance, amount)
- glog.V(logger.Detail).Infof("deposited %d wei to chequebook (%s, balance: %v, target: %v)", amount, self.contractAddr.Hex(), self.balance, self.buffer)
+ log.Trace(fmt.Sprintf("deposited %d wei to chequebook (%s, balance: %v, target: %v)", amount, self.contractAddr.Hex(), self.balance, self.buffer))
return tx.Hash().Hex(), nil
}
@@ -469,7 +468,7 @@ func NewInbox(prvKey *ecdsa.PrivateKey, contractAddr, beneficiary common.Address
session: session,
cashed: new(big.Int).Set(common.Big0),
}
- glog.V(logger.Detail).Infof("initialised inbox (%s -> %s) expected signer: %x", self.contract.Hex(), self.beneficiary.Hex(), crypto.FromECDSAPub(signer))
+ log.Trace(fmt.Sprintf("initialised inbox (%s -> %s) expected signer: %x", self.contract.Hex(), self.beneficiary.Hex(), crypto.FromECDSAPub(signer)))
return
}
@@ -491,7 +490,7 @@ func (self *Inbox) Stop() {
func (self *Inbox) Cash() (txhash string, err error) {
if self.cheque != nil {
txhash, err = self.cheque.Cash(self.session)
- glog.V(logger.Detail).Infof("cashing cheque (total: %v) on chequebook (%s) sending to %v", self.cheque.Amount, self.contract.Hex(), self.beneficiary.Hex())
+ log.Trace(fmt.Sprintf("cashing cheque (total: %v) on chequebook (%s) sending to %v", self.cheque.Amount, self.contract.Hex(), self.beneficiary.Hex()))
self.cashed = self.cheque.Amount
}
return
@@ -575,7 +574,7 @@ func (self *Inbox) Receive(promise swap.Promise) (*big.Int, error) {
self.Cash()
}
}
- glog.V(logger.Detail).Infof("received cheque of %v wei in inbox (%s, uncashed: %v)", amount, self.contract.Hex(), uncashed)
+ log.Trace(fmt.Sprintf("received cheque of %v wei in inbox (%s, uncashed: %v)", amount, self.contract.Hex(), uncashed))
}
return amount, err
@@ -583,7 +582,7 @@ func (self *Inbox) Receive(promise swap.Promise) (*big.Int, error) {
// Verify verifies cheque for signer, contract, beneficiary, amount, valid signature.
func (self *Cheque) Verify(signerKey *ecdsa.PublicKey, contract, beneficiary common.Address, sum *big.Int) (*big.Int, error) {
- glog.V(logger.Detail).Infof("verify cheque: %v - sum: %v", self, sum)
+ log.Trace(fmt.Sprintf("verify cheque: %v - sum: %v", self, sum))
if sum == nil {
return nil, fmt.Errorf("invalid amount")
}
diff --git a/contracts/release/release.go b/contracts/release/release.go
index cd79112cd..7b63059d0 100644
--- a/contracts/release/release.go
+++ b/contracts/release/release.go
@@ -29,8 +29,7 @@ import (
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/internal/ethapi"
"github.com/ethereum/go-ethereum/les"
- "github.com/ethereum/go-ethereum/logger"
- "github.com/ethereum/go-ethereum/logger/glog"
+ "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/rpc"
@@ -128,10 +127,10 @@ func (r *ReleaseService) checker() {
version, err := r.oracle.CurrentVersion(opts)
if err != nil {
if err == bind.ErrNoCode {
- glog.V(logger.Debug).Infof("Release oracle not found at %x", r.config.Oracle)
+ log.Debug(fmt.Sprintf("Release oracle not found at %x", r.config.Oracle))
continue
}
- glog.V(logger.Error).Infof("Failed to retrieve current release: %v", err)
+ log.Error(fmt.Sprintf("Failed to retrieve current release: %v", err))
continue
}
// Version was successfully retrieved, notify if newer than ours
@@ -144,13 +143,13 @@ func (r *ReleaseService) checker() {
howtofix := fmt.Sprintf("Please check https://github.com/ethereum/go-ethereum/releases for new releases")
separator := strings.Repeat("-", len(warning))
- glog.V(logger.Warn).Info(separator)
- glog.V(logger.Warn).Info(warning)
- glog.V(logger.Warn).Info(howtofix)
- glog.V(logger.Warn).Info(separator)
+ log.Warn(fmt.Sprint(separator))
+ log.Warn(fmt.Sprint(warning))
+ log.Warn(fmt.Sprint(howtofix))
+ log.Warn(fmt.Sprint(separator))
} else {
- glog.V(logger.Debug).Infof("Client v%d.%d.%d-%x seems up to date with upstream v%d.%d.%d-%x",
- r.config.Major, r.config.Minor, r.config.Patch, r.config.Commit[:4], version.Major, version.Minor, version.Patch, version.Commit[:4])
+ log.Debug(fmt.Sprintf("Client v%d.%d.%d-%x seems up to date with upstream v%d.%d.%d-%x",
+ r.config.Major, r.config.Minor, r.config.Patch, r.config.Commit[:4], version.Major, version.Minor, version.Patch, version.Commit[:4]))
}
// If termination was requested, return