@@ -74,6 +74,8 @@ type Controller struct {
7474 // lookupPeerID is the peer id to lookup on the bus
7575 // may be empty
7676 lookupPeerID peer.ID
77+ // verbose enables verbose logs
78+ verbose bool
7779
7880 // linkDialers tracks ongoing dial attempts
7981 // when a link is closed (removed from links) the associated dialer is restarted (if any).
@@ -102,6 +104,7 @@ func NewController(
102104 bus bus.Bus ,
103105 info * controller.Info ,
104106 peerID peer.ID ,
107+ verbose bool ,
105108 ctor Constructor ,
106109) * Controller {
107110 c := & Controller {
@@ -110,6 +113,7 @@ func NewController(
110113 ctor : ctor ,
111114 info : info ,
112115 lookupPeerID : peerID ,
116+ verbose : verbose ,
113117
114118 links : make (map [uint64 ]* establishedLink ),
115119 linksByPeerID : make (map [peer.ID ][]* establishedLink ),
@@ -146,9 +150,6 @@ func (c *Controller) GetPeerLinks(peerID peer.ID) []link.Link {
146150// Returning an error triggers a retry with backoff.
147151func (c * Controller ) Execute (ctx context.Context ) error {
148152 // Acquire a handle to the node.
149- c .le .
150- WithField ("peer-id" , c .lookupPeerID .String ()).
151- Debug ("waiting for peer private key" )
152153 localPeer , _ , localPeerRef , err := peer .GetPeerWithID (ctx , c .bus , c .lookupPeerID , false , nil )
153154 if err != nil {
154155 return err
@@ -182,7 +183,9 @@ func (c *Controller) Execute(ctx context.Context) error {
182183 // store the transport
183184 handler .tpt .SetResult (tpt , nil )
184185
185- c .le .Debug ("executing transport" )
186+ if c .verbose {
187+ c .le .Debug ("executing transport" )
188+ }
186189 execCtx , execCtxCancel := context .WithCancel (ctx )
187190 defer execCtxCancel ()
188191
@@ -302,7 +305,9 @@ func (c *Controller) HandleIncomingStream(
302305
303306 // bus is the controller bus
304307 le := c .loggerForLink (lnk ).WithField ("protocol-id" , pid )
305- le .Debug ("accepted stream" )
308+ if c .verbose {
309+ le .Debug ("accepted stream" )
310+ }
306311
307312 dir := link .NewHandleMountedStream (pid , lnk .GetLocalPeer (), mstrm .GetPeerID ())
308313
0 commit comments