Skip to content

Commit ffa9896

Browse files
authored
imp: improve Logger performance (cosmos#1160)
* fix: Logger marshal errors * changelog * update
1 parent ccc4cb8 commit ffa9896

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
4444

4545
### Improvements
4646

47+
* (modules/core/04-channel) [\#1160](https://github.com/cosmos/ibc-go/pull/1160) Improve `uint64 -> string` performance in `Logger`.
48+
4749
### Features
4850

4951
### Bug Fixes

modules/core/04-channel/keeper/packet.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package keeper
22

33
import (
44
"bytes"
5+
"strconv"
56
"time"
67

78
sdk "github.com/cosmos/cosmos-sdk/types"
@@ -129,7 +130,7 @@ func (k Keeper) SendPacket(
129130

130131
k.Logger(ctx).Info(
131132
"packet sent",
132-
"sequence", packet.GetSequence(),
133+
"sequence", strconv.FormatUint(packet.GetSequence(), 10),
133134
"src_port", packet.GetSourcePort(),
134135
"src_channel", packet.GetSourceChannel(),
135136
"dst_port", packet.GetDestPort(),
@@ -284,7 +285,7 @@ func (k Keeper) RecvPacket(
284285
// log that a packet has been received & executed
285286
k.Logger(ctx).Info(
286287
"packet received",
287-
"sequence", packet.GetSequence(),
288+
"sequence", strconv.FormatUint(packet.GetSequence(), 10),
288289
"src_port", packet.GetSourcePort(),
289290
"src_channel", packet.GetSourceChannel(),
290291
"dst_port", packet.GetDestPort(),
@@ -494,7 +495,7 @@ func (k Keeper) AcknowledgePacket(
494495
// log that a packet has been acknowledged
495496
k.Logger(ctx).Info(
496497
"packet acknowledged",
497-
"sequence", packet.GetSequence(),
498+
"sequence", strconv.FormatUint(packet.GetSequence(), 10),
498499
"src_port", packet.GetSourcePort(),
499500
"src_channel", packet.GetSourceChannel(),
500501
"dst_port", packet.GetDestPort(),

modules/core/04-channel/keeper/timeout.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package keeper
22

33
import (
44
"bytes"
5+
"strconv"
56

67
sdk "github.com/cosmos/cosmos-sdk/types"
78
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
@@ -159,7 +160,7 @@ func (k Keeper) TimeoutExecuted(
159160

160161
k.Logger(ctx).Info(
161162
"packet timed-out",
162-
"sequence", packet.GetSequence(),
163+
"sequence", strconv.FormatUint(packet.GetSequence(), 10),
163164
"src_port", packet.GetSourcePort(),
164165
"src_channel", packet.GetSourceChannel(),
165166
"dst_port", packet.GetDestPort(),

0 commit comments

Comments
 (0)