Skip to content

Commit

Permalink
logs: cleanup (#6198)
Browse files Browse the repository at this point in the history
  • Loading branch information
tac0turtle committed Mar 4, 2021
1 parent be88fd3 commit 8c539f7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 20 deletions.
11 changes: 5 additions & 6 deletions consensus/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -1147,8 +1147,7 @@ func (cs *State) defaultDecideProposal(height int64, round int32) {
cs.sendInternalMessage(msgInfo{&BlockPartMessage{cs.Height, cs.Round, part}, ""})
}

cs.Logger.Info("signed proposal", "height", height, "round", round, "proposal", proposal)
cs.Logger.Debug("signed proposal block", "block", block)
cs.Logger.Debug("signed proposal", "height", height, "round", round, "proposal", proposal)
} else if !cs.replayMode {
cs.Logger.Error("propose step; failed signing proposal", "height", height, "round", round, "err", err)
}
Expand Down Expand Up @@ -1661,7 +1660,7 @@ func (cs *State) finalizeCommit(height int64) {
if err != nil {
logger.Error("failed to prune blocks", "retain_height", retainHeight, "err", err)
} else {
logger.Info("pruned blocks", "pruned", pruned, "retain_height", retainHeight)
logger.Debug("pruned blocks", "pruned", pruned, "retain_height", retainHeight)
}
}

Expand Down Expand Up @@ -1960,7 +1959,7 @@ func (cs *State) tryAddVote(vote *types.Vote, peerID p2p.NodeID) (bool, error) {

// report conflicting votes to the evidence pool
cs.evpool.ReportConflictingVotes(voteErr.VoteA, voteErr.VoteB)
cs.Logger.Info(
cs.Logger.Debug(
"found and sent conflicting votes to the evidence pool",
"vote_a", voteErr.VoteA,
"vote_b", voteErr.VoteB,
Expand Down Expand Up @@ -2124,7 +2123,7 @@ func (cs *State) addVote(vote *types.Vote, peerID p2p.NodeID) (added bool, err e

case tmproto.PrecommitType:
precommits := cs.Votes.Precommits(vote.Round)
cs.Logger.Info("added vote to precommit", "vote", vote, "precommits", precommits.StringShort())
cs.Logger.Debug("added vote to precommit", "vote", vote, "precommits", precommits.StringShort())

blockID, ok := precommits.TwoThirdsMajority()
if ok {
Expand Down Expand Up @@ -2233,7 +2232,7 @@ func (cs *State) signAddVote(msgType tmproto.SignedMsgType, hash []byte, header
vote, err := cs.signVote(msgType, hash, header)
if err == nil {
cs.sendInternalMessage(msgInfo{&VoteMessage{vote}, ""})
cs.Logger.Info("signed and pushed vote", "height", cs.Height, "round", cs.Round, "vote", vote)
cs.Logger.Debug("signed and pushed vote", "height", cs.Height, "round", cs.Round, "vote", vote)
return vote
}

Expand Down
10 changes: 5 additions & 5 deletions mempool/clist_mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ func (mem *CListMempool) resCbFirstTime(
}
memTx.senders.Store(peerID, true)
mem.addTx(memTx)
mem.logger.Info("Added good transaction",
mem.logger.Debug("added good transaction",
"tx", txID(tx),
"res", r,
"height", memTx.height,
Expand All @@ -450,7 +450,7 @@ func (mem *CListMempool) resCbFirstTime(
mem.notifyTxsAvailable()
} else {
// ignore bad transaction
mem.logger.Info("Rejected bad transaction",
mem.logger.Debug("rejected bad transaction",
"tx", txID(tx), "peerID", peerP2PID, "res", r, "err", postCheckErr)
mem.metrics.FailedTxs.Add(1)
if !mem.config.KeepInvalidTxsInCache {
Expand Down Expand Up @@ -486,7 +486,7 @@ func (mem *CListMempool) resCbRecheck(req *abci.Request, res *abci.Response) {
// Good, nothing to do.
} else {
// Tx became invalidated due to newly committed block.
mem.logger.Info("Tx is no longer valid", "tx", txID(tx), "res", r, "err", postCheckErr)
mem.logger.Debug("tx is no longer valid", "tx", txID(tx), "res", r, "err", postCheckErr)
// NOTE: we remove tx from the cache because it might be good later
mem.removeTx(tx, mem.recheckCursor, !mem.config.KeepInvalidTxsInCache)
}
Expand All @@ -497,7 +497,7 @@ func (mem *CListMempool) resCbRecheck(req *abci.Request, res *abci.Response) {
}
if mem.recheckCursor == nil {
// Done!
mem.logger.Info("Done rechecking txs")
mem.logger.Debug("done rechecking txs")

// incase the recheck removed all txs
if mem.Size() > 0 {
Expand Down Expand Up @@ -626,7 +626,7 @@ func (mem *CListMempool) Update(
// or just notify there're some txs left.
if mem.Size() > 0 {
if mem.config.Recheck {
mem.logger.Info("Recheck txs", "numtxs", mem.Size(), "height", height)
mem.logger.Debug("recheck txs", "numtxs", mem.Size(), "height", height)
mem.recheckTxs()
// At this point, mem.txs are being rechecked.
// mem.recheckCursor re-scans mem.txs and possibly removes some txs.
Expand Down
12 changes: 4 additions & 8 deletions p2p/shim.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ func (rs *ReactorShim) proxyPeerEnvelopes() {
rs.Logger.Error(
"failed to proxy envelope; failed to wrap message",
"ch_id", cs.Descriptor.ID,
"msg", e.Message,
"err", err,
)
continue
Expand All @@ -124,7 +123,6 @@ func (rs *ReactorShim) proxyPeerEnvelopes() {
rs.Logger.Error(
"failed to proxy envelope; failed to encode message",
"ch_id", cs.Descriptor.ID,
"msg", e.Message,
"err", err,
)
continue
Expand All @@ -140,7 +138,6 @@ func (rs *ReactorShim) proxyPeerEnvelopes() {
rs.Logger.Debug(
"failed to proxy envelope; failed to find peer",
"ch_id", cs.Descriptor.ID,
"msg", e.Message,
"peer", e.To,
)
continue
Expand All @@ -150,13 +147,12 @@ func (rs *ReactorShim) proxyPeerEnvelopes() {
rs.Logger.Error(
"failed to proxy message to peer",
"ch_id", cs.Descriptor.ID,
"msg", e.Message,
"peer", e.To,
)
}

default:
rs.Logger.Error("failed to proxy envelope; missing peer ID", "ch_id", cs.Descriptor.ID, "msg", e.Message)
rs.Logger.Error("failed to proxy envelope; missing peer ID", "ch_id", cs.Descriptor.ID)
}
}
}(cs)
Expand Down Expand Up @@ -294,15 +290,15 @@ func (rs *ReactorShim) Receive(chID byte, src Peer, msgBytes []byte) {
msg.Reset()

if err := proto.Unmarshal(msgBytes, msg); err != nil {
rs.Logger.Error("error decoding message", "peer", src, "ch_id", cID, "msg", msg, "err", err)
rs.Logger.Error("error decoding message", "peer", src, "ch_id", cID, "err", err)
rs.Switch.StopPeerForError(src, err)
return
}

validator, ok := msg.(messageValidator)
if ok {
if err := validator.Validate(); err != nil {
rs.Logger.Error("invalid message", "peer", src, "ch_id", cID, "msg", msg, "err", err)
rs.Logger.Error("invalid message", "peer", src, "ch_id", cID, "err", err)
rs.Switch.StopPeerForError(src, err)
return
}
Expand All @@ -314,7 +310,7 @@ func (rs *ReactorShim) Receive(chID byte, src Peer, msgBytes []byte) {

msg, err = wrapper.Unwrap()
if err != nil {
rs.Logger.Error("failed to unwrap message", "peer", src, "ch_id", chID, "msg", msg, "err", err)
rs.Logger.Error("failed to unwrap message", "peer", src, "ch_id", chID, "err", err)
return
}
}
Expand Down
2 changes: 1 addition & 1 deletion rpc/jsonrpc/server/http_json_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func makeJSONRPCHandler(funcMap map[string]*RPCFunc, logger log.Logger) http.Han
}

returns := rpcFunc.f.Call(args)

logger.Debug("HTTPJSONRPC", "method", request.Method, "args", args, "returns", returns)
result, err := unreflectResult(returns)
switch e := err.(type) {
// if no error then return a success response
Expand Down

0 comments on commit 8c539f7

Please sign in to comment.