From db671d3891fbae5cfc3fd9b3dba892c3dbdce9a3 Mon Sep 17 00:00:00 2001 From: "Lawrence, Rendall" Date: Fri, 18 Nov 2022 16:05:03 +0300 Subject: [PATCH] (minor) change `Bytes` with `Hex` call in logger --- frontend/udp/connection_id.go | 4 ++-- frontend/udp/connection_id_test.go | 2 +- storage/pg/storage.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/udp/connection_id.go b/frontend/udp/connection_id.go index de5df66..f904419 100644 --- a/frontend/udp/connection_id.go +++ b/frontend/udp/connection_id.go @@ -84,7 +84,7 @@ func (g *ConnectionIDGenerator) Generate(ip netip.Addr, now time.Time) []byte { log.Debug(). Stringer("ip", ip). Time("now", now). - Bytes("connID", g.connID). + Hex("connID", g.connID). Msg("generated connection ID") return g.connID } @@ -95,7 +95,7 @@ func (g *ConnectionIDGenerator) Validate(connectionID []byte, ip netip.Addr, now log.Debug(). Stringer("ip", ip). Time("ts", ts).Time("now", now). - Bytes("connID", g.connID). + Hex("connID", g.connID). Msg("validating connection ID") if now.After(ts.Add(ttl)) || ts.After(now.Add(maxClockSkew)) { return false diff --git a/frontend/udp/connection_id_test.go b/frontend/udp/connection_id_test.go index 90f1022..5dcd5a8 100644 --- a/frontend/udp/connection_id_test.go +++ b/frontend/udp/connection_id_test.go @@ -60,7 +60,7 @@ func simpleNewConnectionID(ip netip.Addr, now time.Time, key string) []byte { log.Debug(). Stringer("ip", ip). Time("now", now). - Bytes("connID", buf). + Hex("connID", buf). Msg("manually generated connection ID") return buf } diff --git a/storage/pg/storage.go b/storage/pg/storage.go index 124e2bf..af0210b 100644 --- a/storage/pg/storage.go +++ b/storage/pg/storage.go @@ -475,7 +475,7 @@ func (s *store) getPeers(ctx context.Context, ih bittorrent.InfoHash, seeders bo } else { logger.Warn(). Err(err). - Bytes("peerID", id). + Hex("peerID", id). IPAddr("ip", ip). Int("port", port). Msg("unable to scan/construct peer") @@ -552,7 +552,7 @@ func (s *store) countPeers(ctx context.Context, ih []byte) (seeders uint32, leec } } if err != nil { - logger.Error().Err(err).Bytes("infoHash", ih).Msg("unable to get peers count") + logger.Error().Err(err).Hex("infoHash", ih).Msg("unable to get peers count") } return }