aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/dagger.go
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2014-06-23 19:54:10 +0800
committerzelig <viktor.tron@gmail.com>2014-06-23 19:54:10 +0800
commitb9e8a3e02493d5bbf23cfcab259e66f6ae166612 (patch)
tree63a13e2d4bfb3daf0a9b06b32b8ef8b849556781 /ethchain/dagger.go
parent8e9cc3697944c3e568186a5c23ac729f6eb4a1f4 (diff)
downloadgo-tangerine-b9e8a3e02493d5bbf23cfcab259e66f6ae166612.tar.gz
go-tangerine-b9e8a3e02493d5bbf23cfcab259e66f6ae166612.tar.zst
go-tangerine-b9e8a3e02493d5bbf23cfcab259e66f6ae166612.zip
modified logging API
- package vars for tagged loggers - weed out spurious fmt.PrintX and log.PrintX logging - tried to second guess loglevel for some :)
Diffstat (limited to 'ethchain/dagger.go')
-rw-r--r--ethchain/dagger.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/ethchain/dagger.go b/ethchain/dagger.go
index 565e1e447..43725e336 100644
--- a/ethchain/dagger.go
+++ b/ethchain/dagger.go
@@ -2,14 +2,16 @@ package ethchain
import (
"github.com/ethereum/eth-go/ethutil"
+ "github.com/ethereum/eth-go/ethlog"
"github.com/obscuren/sha3"
"hash"
- "log"
"math/big"
"math/rand"
"time"
)
+var powlogger = ethlog.NewLogger("POW")
+
type PoW interface {
Search(block *Block, reactChan chan ethutil.React) []byte
Verify(hash []byte, diff *big.Int, nonce []byte) bool
@@ -29,14 +31,14 @@ func (pow *EasyPow) Search(block *Block, reactChan chan ethutil.React) []byte {
for {
select {
case <-reactChan:
- //ethutil.Config.Log.Infoln("[POW] Received reactor event; breaking out.")
+ //powlogger.Infoln("Received reactor event; breaking out.")
return nil
default:
i++
if i%1234567 == 0 {
elapsed := time.Now().UnixNano() - start
hashes := ((float64(1e9) / float64(elapsed)) * float64(i)) / 1000
- ethutil.Config.Log.Infoln("[POW] Hashing @", int64(hashes), "khash")
+ powlogger.Infoln("Hashing @", int64(hashes), "khash")
}
sha := ethutil.Sha3Bin(big.NewInt(r.Int63()).Bytes())
@@ -81,7 +83,7 @@ func (dag *Dagger) Find(obj *big.Int, resChan chan int64) {
rnd := r.Int63()
res := dag.Eval(big.NewInt(rnd))
- log.Printf("rnd %v\nres %v\nobj %v\n", rnd, res, obj)
+ powlogger.Infof("rnd %v\nres %v\nobj %v\n", rnd, res, obj)
if res.Cmp(obj) < 0 {
// Post back result on the channel
resChan <- rnd