Skip to content

Commit

Permalink
chore: clean up logging
Browse files Browse the repository at this point in the history
  • Loading branch information
byte-bandit committed May 24, 2024
1 parent 0e9e86b commit 5e7eb9e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions chain/paloma/wrappers.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,14 @@ func (m *PalomaMessageSender) SendMsg(ctx context.Context, msg sdk.Msg, memo str
signer := m.GetSigner()

logger.WithField("creator", creator).WithField("signer", signer).Debug("Injecting metadata")

if err := tryInjectMetadata(msg, vtypes.MsgMetadata{
Creator: m.GetCreator(),
Signers: []string{signer},
}); err != nil {
return nil, fmt.Errorf("failed to inject metadata: %w", err)
}

liblog.WithContext(ctx).WithField("msg", msg).Info("sending-msg")

logger.WithField("msg", msg).Debug("Sending message...")
res, err := m.W.SendMsg(ctx, msg, memo, opts...)
if IsPalomaDown(err) {
return nil, whoops.Wrap(ErrPalomaIsDown, err)
Expand Down
3 changes: 2 additions & 1 deletion util/ion/broadcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ func broadcastTx(
// in the mempool or we can retry the broadcast at that
// point
syncRes, err := broadcaster.BroadcastTxSync(ctx, tx)
liblog.WithContext(ctx).WithError(err).WithField("result", syncRes).Warn("broastcastTX")
if err != nil {
liblog.WithContext(ctx).WithError(err).Warn("Failed to broadcast TX.")
if syncRes == nil {
// There are some cases where BroadcastTxSync will return an error but the associated
// ResultBroadcastTx will be nil.
Expand All @@ -86,6 +86,7 @@ func broadcastTx(
// This catches all of the sdk errors https://github.com/cosmos/cosmos-sdk/blob/f10f5e5974d2ecbf9efc05bc0bfe1c99fdeed4b6/types/errors/errors.go
err = errors.Unwrap(sdkerrors.ABCIError(syncRes.Codespace, syncRes.Code, "error broadcasting transaction"))
if err.Error() != errUnknown {
liblog.WithContext(ctx).WithError(err).WithField("sync-result", syncRes).Warn("Failed to broadcast TX.")
return nil, err
}
if syncRes.Code != 0 {
Expand Down
3 changes: 0 additions & 3 deletions util/ion/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ func (cc *Client) SendMsgs(ctx context.Context, msgs []sdk.Msg, memo string, opt
return nil, err
}

liblog.WithContext(ctx).WithField("component", "send-msgs").WithField("txf", txf).WithField("calculated-gas", adjusted).Info("Finished building txf")

// Generate the transaction bytes
txBytes, err := cc.Codec.TxConfig.TxEncoder()(txb.GetTx())
if err != nil {
Expand All @@ -127,7 +125,6 @@ func (cc *Client) SendMsgs(ctx context.Context, msgs []sdk.Msg, memo string, opt
// Broadcast those bytes
res, err := cc.BroadcastTx(ctx, txBytes)
if err != nil {
liblog.WithContext(ctx).WithField("component", "send-msgs").WithField("txf", txf).WithField("calculated-gas", adjusted).WithError(err).Warn("failed")
return nil, fmt.Errorf("failed to broadcast tx: %w", err)
}

Expand Down

0 comments on commit 5e7eb9e

Please sign in to comment.