aboutsummaryrefslogtreecommitdiffstats
path: root/eth/peer.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-03-02 21:06:16 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2017-03-02 21:06:16 +0800
commit9184249b393e4e332ae6a2f5d774880a88a9bfd6 (patch)
tree7788ce54cb04d1af4fe03ab3c2447354bcaac3cc /eth/peer.go
parent82e7c1d1241737fd0ae9b25e0f20857b8597b148 (diff)
downloadgo-tangerine-9184249b393e4e332ae6a2f5d774880a88a9bfd6.tar
go-tangerine-9184249b393e4e332ae6a2f5d774880a88a9bfd6.tar.gz
go-tangerine-9184249b393e4e332ae6a2f5d774880a88a9bfd6.tar.bz2
go-tangerine-9184249b393e4e332ae6a2f5d774880a88a9bfd6.tar.lz
go-tangerine-9184249b393e4e332ae6a2f5d774880a88a9bfd6.tar.xz
go-tangerine-9184249b393e4e332ae6a2f5d774880a88a9bfd6.tar.zst
go-tangerine-9184249b393e4e332ae6a2f5d774880a88a9bfd6.zip
Logger updates 3 (#3730)
* accounts, cmd, eth, ethdb: port logs over to new system * ethdb: drop concept of cache distribution between dbs * eth: fix some log nitpicks to make them nicer
Diffstat (limited to 'eth/peer.go')
-rw-r--r--eth/peer.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/eth/peer.go b/eth/peer.go
index e87438953..443463b8c 100644
--- a/eth/peer.go
+++ b/eth/peer.go
@@ -25,7 +25,6 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
- "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/rlp"
"gopkg.in/fatih/set.v0"
@@ -191,41 +190,41 @@ func (p *peer) SendReceiptsRLP(receipts []rlp.RawValue) error {
// RequestHeaders is a wrapper around the header query functions to fetch a
// single header. It is used solely by the fetcher.
func (p *peer) RequestOneHeader(hash common.Hash) error {
- log.Debug(fmt.Sprintf("%v fetching a single header: %x", p, hash))
+ p.Log().Debug("Fetching single header", "hash", hash)
return p2p.Send(p.rw, GetBlockHeadersMsg, &getBlockHeadersData{Origin: hashOrNumber{Hash: hash}, Amount: uint64(1), Skip: uint64(0), Reverse: false})
}
// RequestHeadersByHash fetches a batch of blocks' headers corresponding to the
// specified header query, based on the hash of an origin block.
func (p *peer) RequestHeadersByHash(origin common.Hash, amount int, skip int, reverse bool) error {
- log.Debug(fmt.Sprintf("%v fetching %d headers from %x, skipping %d (reverse = %v)", p, amount, origin[:4], skip, reverse))
+ p.Log().Debug("Fetching batch of headers", "count", amount, "fromhash", origin, "skip", skip, "reverse", reverse)
return p2p.Send(p.rw, GetBlockHeadersMsg, &getBlockHeadersData{Origin: hashOrNumber{Hash: origin}, Amount: uint64(amount), Skip: uint64(skip), Reverse: reverse})
}
// RequestHeadersByNumber fetches a batch of blocks' headers corresponding to the
// specified header query, based on the number of an origin block.
func (p *peer) RequestHeadersByNumber(origin uint64, amount int, skip int, reverse bool) error {
- log.Debug(fmt.Sprintf("%v fetching %d headers from #%d, skipping %d (reverse = %v)", p, amount, origin, skip, reverse))
+ p.Log().Debug("Fetching batch of headers", "count", amount, "fromnum", origin, "skip", skip, "reverse", reverse)
return p2p.Send(p.rw, GetBlockHeadersMsg, &getBlockHeadersData{Origin: hashOrNumber{Number: origin}, Amount: uint64(amount), Skip: uint64(skip), Reverse: reverse})
}
// RequestBodies fetches a batch of blocks' bodies corresponding to the hashes
// specified.
func (p *peer) RequestBodies(hashes []common.Hash) error {
- log.Debug(fmt.Sprintf("%v fetching %d block bodies", p, len(hashes)))
+ p.Log().Debug("Fetching batch of block bodies", "count", len(hashes))
return p2p.Send(p.rw, GetBlockBodiesMsg, hashes)
}
// RequestNodeData fetches a batch of arbitrary data from a node's known state
// data, corresponding to the specified hashes.
func (p *peer) RequestNodeData(hashes []common.Hash) error {
- log.Debug(fmt.Sprintf("%v fetching %v state data", p, len(hashes)))
+ p.Log().Debug("Fetching batch of state data", "count", len(hashes))
return p2p.Send(p.rw, GetNodeDataMsg, hashes)
}
// RequestReceipts fetches a batch of transaction receipts from a remote node.
func (p *peer) RequestReceipts(hashes []common.Hash) error {
- log.Debug(fmt.Sprintf("%v fetching %v receipts", p, len(hashes)))
+ p.Log().Debug("Fetching batch of receipts", "count", len(hashes))
return p2p.Send(p.rw, GetReceiptsMsg, hashes)
}