Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve logs #866

Merged
merged 2 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions internal/consensus/state_add_prop_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ func (c *AddProposalBlockPartAction) addProposalBlockPart(
"height", stateData.RoundState.Height,
"round", stateData.RoundState.Round,
"hash", stateData.ProposalBlock.Hash(),
"peer", peerID,
)
// We received a commit before the block
// Transit to AddCommit
Expand All @@ -180,6 +181,7 @@ func (c *AddProposalBlockPartAction) addProposalBlockPart(
"hash", stateData.ProposalBlock.Hash(),
"round_height", stateData.RoundState.GetHeight(),
"num_txs", len(stateData.ProposalBlock.Txs),
"peer", peerID,
)

c.eventPublisher.PublishCompleteProposalEvent(stateData.CompleteProposalEvent())
Expand Down
2 changes: 1 addition & 1 deletion internal/consensus/state_prevoter.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func newPrevote(logger log.Logger, voteSigner *voteSigner, blockExec *blockExecu
func (p *prevoter) Do(ctx context.Context, stateData *StateData) error {
err := stateData.isValidForPrevote()
if err != nil {
keyVals := append(prevoteKeyVals(stateData), "error", err)
keyVals := append(prevoteKeyVals(stateData), "err", err)

if !errors.Is(err, errPrevoteProposalBlockNil) {
p.logger.Error("prevote is invalid", keyVals...)
Expand Down
8 changes: 4 additions & 4 deletions internal/p2p/conn/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func (c *MConnection) String() string {
}

func (c *MConnection) flush() {
c.logger.Trace("Flush", "conn", c)
// c.logger.Trace("Flush", "conn", c)
err := c.bufConnWriter.Flush()
if err != nil {
c.logger.Debug("MConnection flush failed", "err", err)
Expand Down Expand Up @@ -304,7 +304,7 @@ func (c *MConnection) Send(chID ChannelID, msgBytes []byte) bool {
return false
}

c.logger.Trace("Send", "channel", chID, "conn", c, "msgBytes", msgBytes)
// c.logger.Trace("Send", "channel", chID, "conn", c, "msgBytes", msgBytes)

// Send message to channel.
channel, ok := c.channelsIdx[chID]
Expand Down Expand Up @@ -557,7 +557,7 @@ FOR_LOOP:
break FOR_LOOP
}
if msgBytes != nil {
c.logger.Trace("Received bytes", "chID", channelID, "msgBytes", msgBytes)
// c.logger.Trace("Received bytes", "chID", channelID, "msgBytes", msgBytes)
// NOTE: This means the reactor.Receive runs in the same thread as the p2p recv routine
c.onReceive(ctx, channelID, msgBytes)
}
Expand Down Expand Up @@ -735,7 +735,7 @@ func (ch *channel) writePacketMsgTo(w io.Writer) (n int, err error) {
// complete, which is owned by the caller and will not be modified.
// Not goroutine-safe
func (ch *channel) recvPacketMsg(packet tmp2p.PacketMsg) ([]byte, error) {
ch.logger.Trace("Read PacketMsg", "conn", ch.conn, "packet", packet)
// ch.logger.Trace("Read PacketMsg", "conn", ch.conn, "packet", packet)
var recvCap, recvReceived = ch.desc.RecvMessageCapacity, len(ch.recving) + len(packet.Data)
if recvCap < recvReceived {
return nil, fmt.Errorf("received message exceeds available capacity: %v < %v", recvCap, recvReceived)
Expand Down
Loading