@@ -35,6 +35,7 @@ import (
35
35
"github.com/libp2p/go-libp2p/core/routing"
36
36
"go.opentelemetry.io/otel/attribute"
37
37
"go.opentelemetry.io/otel/trace"
38
+ "go.uber.org/zap/zapcore"
38
39
)
39
40
40
41
var log = logging .Logger ("bitswap/client" )
@@ -379,8 +380,10 @@ func (bs *Client) receiveBlocksFrom(ctx context.Context, from peer.ID, blks []bl
379
380
}
380
381
381
382
wanted , notWanted := bs .sim .SplitWantedUnwanted (blks )
382
- for _ , b := range notWanted {
383
- log .Debugf ("[recv] block not in wantlist; cid=%s, peer=%s" , b .Cid (), from )
383
+ if log .Level ().Enabled (zapcore .DebugLevel ) {
384
+ for _ , b := range notWanted {
385
+ log .Debugf ("[recv] block not in wantlist; cid=%s, peer=%s" , b .Cid (), from )
386
+ }
384
387
}
385
388
386
389
allKs := make ([]cid.Cid , 0 , len (blks ))
@@ -409,10 +412,6 @@ func (bs *Client) receiveBlocksFrom(ctx context.Context, from peer.ID, blks []bl
409
412
bs .notif .Publish (from , b )
410
413
}
411
414
412
- for _ , b := range wanted {
413
- log .Debugw ("Bitswap.GetBlockRequest.End" , "cid" , b .Cid ())
414
- }
415
-
416
415
return nil
417
416
}
418
417
@@ -431,8 +430,10 @@ func (bs *Client) ReceiveMessage(ctx context.Context, p peer.ID, incoming bsmsg.
431
430
432
431
if len (iblocks ) > 0 {
433
432
bs .updateReceiveCounters (iblocks )
434
- for _ , b := range iblocks {
435
- log .Debugf ("[recv] block; cid=%s, peer=%s" , b .Cid (), p )
433
+ if log .Level ().Enabled (zapcore .DebugLevel ) {
434
+ for _ , b := range iblocks {
435
+ log .Debugf ("[recv] block; cid=%s, peer=%s" , b .Cid (), p )
436
+ }
436
437
}
437
438
}
438
439
0 commit comments