fix: log format

This commit is contained in:
Richard Ramos 2022-11-21 10:53:24 -04:00 committed by RichΛrd
parent e3b2bd5774
commit 22404a0608
3 changed files with 5 additions and 5 deletions

View File

@ -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))
}

View File

@ -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)
}

View File

@ -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,