From 22404a06087a835b0716b970ad75345afa6eb82d Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Mon, 21 Nov 2022 10:53:24 -0400 Subject: [PATCH] fix: log format --- logging/logging.go | 6 +++--- waku/v2/protocol/pb/utils_test.go | 2 +- waku/v2/protocol/store/waku_store.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/logging/logging.go b/logging/logging.go index 130cc75d..7a2e9f65 100644 --- a/logging/logging.go +++ b/logging/logging.go @@ -24,8 +24,8 @@ import ( type byteArr [][]byte // HexArray creates a field with an array of bytes that will be shown as a hexadecimal string in logs -func HexArray(key string, byteVal ...[]byte) zapcore.Field { - return zap.Array(key, byteArr(byteVal)) +func HexArray(key string, byteVal byteArr) zapcore.Field { + return zap.Array(key, byteVal) } func (bArr byteArr) MarshalLogArray(encoder zapcore.ArrayEncoder) error { @@ -37,7 +37,7 @@ func (bArr byteArr) MarshalLogArray(encoder zapcore.ArrayEncoder) error { type hexByte []byte -func HexString(key string, byteVal []byte) zapcore.Field { +func HexString(key string, byteVal hexByte) zapcore.Field { return zap.Stringer(key, hexByte(byteVal)) } diff --git a/waku/v2/protocol/pb/utils_test.go b/waku/v2/protocol/pb/utils_test.go index dbc3803c..ed72831d 100644 --- a/waku/v2/protocol/pb/utils_test.go +++ b/waku/v2/protocol/pb/utils_test.go @@ -20,7 +20,7 @@ func TestEnvelopeHash(t *testing.T) { msg.Version = 1 expected := []byte{0xf8, 0xa4, 0x70, 0x32, 0x76, 0xf2, 0x36, 0x99, 0x24, 0xc5, 0xfe, 0x36, 0xee, 0x3a, 0x96, 0xcb, 0xca, 0x45, 0x54, 0xed, 0xd3, 0x1a, 0x19, 0xb1, 0x68, 0xac, 0x49, 0xe9, 0x26, 0xed, 0xb6, 0xc6} - result, err := msg.Hash() + result, _, err := msg.Hash() require.NoError(t, err) require.Equal(t, expected, result) } diff --git a/waku/v2/protocol/store/waku_store.go b/waku/v2/protocol/store/waku_store.go index 8d4eae10..0b722dad 100644 --- a/waku/v2/protocol/store/waku_store.go +++ b/waku/v2/protocol/store/waku_store.go @@ -497,7 +497,7 @@ func (store *WakuStore) Query(ctx context.Context, query Query, opts ...HistoryR messageID, _, _ := m.Hash() messageIDs = append(messageIDs, messageID) } - store.log.Info("waku.store retrieved", logging.HexArray("hashes", messageIDs...)) + store.log.Info("waku.store retrieved", logging.HexArray("hashes", messageIDs)) result := &Result{ Messages: response.Messages,