aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-04-07 20:57:04 +0800
committerobscuren <geffobscura@gmail.com>2015-04-07 20:57:04 +0800
commit688d118c7e0d439691e84fc6e068ab3e19da5185 (patch)
tree6891a60950e0c2956c9f2d4fed6fceb67430775c /eth
parent01b2c90179ff82e4610745aea0e3e3ca53756305 (diff)
downloaddexon-688d118c7e0d439691e84fc6e068ab3e19da5185.tar
dexon-688d118c7e0d439691e84fc6e068ab3e19da5185.tar.gz
dexon-688d118c7e0d439691e84fc6e068ab3e19da5185.tar.bz2
dexon-688d118c7e0d439691e84fc6e068ab3e19da5185.tar.lz
dexon-688d118c7e0d439691e84fc6e068ab3e19da5185.tar.xz
dexon-688d118c7e0d439691e84fc6e068ab3e19da5185.tar.zst
dexon-688d118c7e0d439691e84fc6e068ab3e19da5185.zip
Updated logging
Diffstat (limited to 'eth')
-rw-r--r--eth/backend.go14
-rw-r--r--eth/protocol_test.go4
2 files changed, 9 insertions, 9 deletions
diff --git a/eth/backend.go b/eth/backend.go
index ffc970212..6b60af1f1 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -18,6 +18,7 @@ import (
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
+ "github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/miner"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/discover"
@@ -26,7 +27,6 @@ import (
)
var (
- servlogger = logger.NewLogger("SERV")
jsonlogger = logger.NewJsonLogger()
defaultBootNodes = []*discover.Node{
@@ -83,7 +83,7 @@ func (cfg *Config) parseBootNodes() []*discover.Node {
}
n, err := discover.ParseNode(url)
if err != nil {
- servlogger.Errorf("Bootstrap URL %s: %v\n", url, err)
+ glog.V(logger.Error).Infof("Bootstrap URL %s: %v\n", url, err)
continue
}
ns = append(ns, n)
@@ -107,7 +107,7 @@ func (cfg *Config) nodeKey() (*ecdsa.PrivateKey, error) {
return nil, fmt.Errorf("could not generate server key: %v", err)
}
if err := ioutil.WriteFile(keyfile, crypto.FromECDSA(key), 0600); err != nil {
- servlogger.Errorln("could not persist nodekey: ", err)
+ glog.V(logger.Error).Infoln("could not persist nodekey: ", err)
}
return key, nil
}
@@ -177,7 +177,7 @@ func New(config *Config) (*Ethereum, error) {
return nil, fmt.Errorf("Database version mismatch. Protocol(%d / %d). `rm -rf %s`", protov, config.ProtocolVersion, path)
}
saveProtocolVersion(blockDb, config.ProtocolVersion)
- servlogger.Infof("Protocol Version: %v, Network Id: %v", config.ProtocolVersion, config.NetworkId)
+ glog.V(logger.Info).Infof("Protocol Version: %v, Network Id: %v", config.ProtocolVersion, config.NetworkId)
eth := &Ethereum{
shutdownChan: make(chan bool),
@@ -303,7 +303,7 @@ func (s *Ethereum) StartMining() error {
eb, err := s.Etherbase()
if err != nil {
err = fmt.Errorf("Cannot start mining without etherbase address: %v", err)
- servlogger.Errorln(err)
+ glog.V(logger.Error).Infoln(err)
return err
}
@@ -380,7 +380,7 @@ func (s *Ethereum) Start() error {
s.blockSub = s.eventMux.Subscribe(core.ChainHeadEvent{})
go s.blockBroadcastLoop()
- servlogger.Infoln("Server started")
+ glog.V(logger.Info).Infoln("Server started")
return nil
}
@@ -420,7 +420,7 @@ func (s *Ethereum) Stop() {
s.whisper.Stop()
}
- servlogger.Infoln("Server stopped")
+ glog.V(logger.Info).Infoln("Server stopped")
close(s.shutdownChan)
}
diff --git a/eth/protocol_test.go b/eth/protocol_test.go
index d3466326a..7c724f7a7 100644
--- a/eth/protocol_test.go
+++ b/eth/protocol_test.go
@@ -250,7 +250,7 @@ func TestNewBlockMsg(t *testing.T) {
var delay = 1 * time.Second
// eth.reset()
- block := types.NewBlock(common.Hash{1}, common.Address{1}, common.Hash{1}, common.Big1, 1, "extra")
+ block := types.NewBlock(common.Hash{1}, common.Address{1}, common.Hash{1}, common.Big1, 1, []byte("extra"))
go p2p.Send(eth, NewBlockMsg, &newBlockMsgData{Block: block})
timer := time.After(delay)
@@ -315,7 +315,7 @@ func TestBlockMsg(t *testing.T) {
var delay = 3 * time.Second
// eth.reset()
newblock := func(i int64) *types.Block {
- return types.NewBlock(common.Hash{byte(i)}, common.Address{byte(i)}, common.Hash{byte(i)}, big.NewInt(i), uint64(i), string(i))
+ return types.NewBlock(common.Hash{byte(i)}, common.Address{byte(i)}, common.Hash{byte(i)}, big.NewInt(i), uint64(i), []byte{byte(i)})
}
b := newblock(0)
b.Header().Difficulty = nil // check if nil as *big.Int decodes as 0