From e7030c4bf59e8e148822c50ae1a5896c604c38c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Fri, 3 Mar 2017 11:41:52 +0200 Subject: all: update light logs (and a few others) to the new model --- les/peer.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'les/peer.go') diff --git a/les/peer.go b/les/peer.go index 4d00f3df9..ef5f8a6ce 100644 --- a/les/peer.go +++ b/les/peer.go @@ -27,7 +27,6 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/les/flowcontrol" - "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/rlp" ) @@ -195,51 +194,51 @@ func (p *peer) SendHeaderProofs(reqID, bv uint64, proofs []ChtResp) error { // 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(reqID, cost uint64, 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 sendRequest(p.rw, GetBlockHeadersMsg, reqID, cost, &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(reqID, cost, 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 sendRequest(p.rw, GetBlockHeadersMsg, reqID, cost, &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(reqID, cost uint64, 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 sendRequest(p.rw, GetBlockBodiesMsg, reqID, cost, hashes) } // RequestCode fetches a batch of arbitrary data from a node's known state // data, corresponding to the specified hashes. func (p *peer) RequestCode(reqID, cost uint64, reqs []*CodeReq) error { - log.Debug(fmt.Sprintf("%v fetching %v state data", p, len(reqs))) + p.Log().Debug("Fetching batch of codes", "count", len(reqs)) return sendRequest(p.rw, GetCodeMsg, reqID, cost, reqs) } // RequestReceipts fetches a batch of transaction receipts from a remote node. func (p *peer) RequestReceipts(reqID, cost uint64, 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 sendRequest(p.rw, GetReceiptsMsg, reqID, cost, hashes) } // RequestProofs fetches a batch of merkle proofs from a remote node. func (p *peer) RequestProofs(reqID, cost uint64, reqs []*ProofReq) error { - log.Debug(fmt.Sprintf("%v fetching %v proofs", p, len(reqs))) + p.Log().Debug("Fetching batch of proofs", "count", len(reqs)) return sendRequest(p.rw, GetProofsMsg, reqID, cost, reqs) } // RequestHeaderProofs fetches a batch of header merkle proofs from a remote node. func (p *peer) RequestHeaderProofs(reqID, cost uint64, reqs []*ChtReq) error { - log.Debug(fmt.Sprintf("%v fetching %v header proofs", p, len(reqs))) + p.Log().Debug("Fetching batch of header proofs", "count", len(reqs)) return sendRequest(p.rw, GetHeaderProofsMsg, reqID, cost, reqs) } func (p *peer) SendTxs(cost uint64, txs types.Transactions) error { - log.Debug(fmt.Sprintf("%v relaying %v txs", p, len(txs))) + p.Log().Debug("Fetching batch of transactions", "count", len(txs)) reqID := getNextReqID() p.fcServer.MustAssignRequest(reqID) p.fcServer.SendRequest(reqID, cost) -- cgit v1.2.3