Commit 813afff6 authored by Rinke Hendriksen's avatar Rinke Hendriksen Committed by GitHub

make logs more user friendly (#1145)

parent de58bae5
...@@ -167,8 +167,6 @@ func (k *Kad) manage() { ...@@ -167,8 +167,6 @@ func (k *Kad) manage() {
return false, false, err return false, false, err
} }
k.logger.Debugf("kademlia dialing to peer %s", peer.String())
err = k.connect(ctx, peer, bzzAddr.Underlay, po) err = k.connect(ctx, peer, bzzAddr.Underlay, po)
if err != nil { if err != nil {
if errors.Is(err, errOverlayMismatch) { if errors.Is(err, errOverlayMismatch) {
...@@ -177,8 +175,8 @@ func (k *Kad) manage() { ...@@ -177,8 +175,8 @@ func (k *Kad) manage() {
k.logger.Debugf("could not remove peer from addressbook: %s", peer.String()) k.logger.Debugf("could not remove peer from addressbook: %s", peer.String())
} }
} }
k.logger.Debugf("could not connect to peer from kademlia %s: %v", bzzAddr.String(), err) k.logger.Debugf("peer not reachable from kademlia %s: %v", bzzAddr.String(), err)
k.logger.Warningf("could not connect to peer") k.logger.Warningf("peer not reachable when attempting to connect")
// continue to next // continue to next
return false, false, nil return false, false, nil
} }
...@@ -340,6 +338,7 @@ func recalcDepth(peers *pslice.PSlice) uint8 { ...@@ -340,6 +338,7 @@ func recalcDepth(peers *pslice.PSlice) uint8 {
// connect connects to a peer and gossips its address to our connected peers, // connect connects to a peer and gossips its address to our connected peers,
// as well as sends the peers we are connected to to the newly connected peer // as well as sends the peers we are connected to to the newly connected peer
func (k *Kad) connect(ctx context.Context, peer swarm.Address, ma ma.Multiaddr, po uint8) error { func (k *Kad) connect(ctx context.Context, peer swarm.Address, ma ma.Multiaddr, po uint8) error {
k.logger.Infof("attempting to connect to peer %s", peer)
ctx, cancel := context.WithTimeout(ctx, 5*time.Second) ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel() defer cancel()
i, err := k.p2p.Connect(ctx, ma) i, err := k.p2p.Connect(ctx, ma)
......
...@@ -170,7 +170,7 @@ func (s *Service) Handshake(ctx context.Context, stream p2p.Stream, peerMultiadd ...@@ -170,7 +170,7 @@ func (s *Service) Handshake(ctx context.Context, stream p2p.Stream, peerMultiadd
s.logger.Tracef("handshake finished for peer (outbound) %s", remoteBzzAddress.Overlay.String()) s.logger.Tracef("handshake finished for peer (outbound) %s", remoteBzzAddress.Overlay.String())
if len(resp.Ack.WelcomeMessage) > 0 { if len(resp.Ack.WelcomeMessage) > 0 {
s.logger.Infof("greeting <%s> from peer: %s", resp.Ack.WelcomeMessage, remoteBzzAddress.Overlay.String()) s.logger.Infof("greeting \"%s\" from peer: %s", resp.Ack.WelcomeMessage, remoteBzzAddress.Overlay.String())
} }
return &Info{ return &Info{
......
...@@ -304,7 +304,9 @@ func New(ctx context.Context, signer beecrypto.Signer, networkID uint64, overlay ...@@ -304,7 +304,9 @@ func New(ctx context.Context, signer beecrypto.Signer, networkID uint64, overlay
} }
s.metrics.HandledStreamCount.Inc() s.metrics.HandledStreamCount.Inc()
s.logger.Infof("successfully connected to peer (inbound) %s", i.BzzAddress.ShortString()) s.logger.Debugf("successfully connected to peer %s (inbound)", i.BzzAddress.ShortString())
s.logger.Infof("successfully connected to peer %s (inbound)", i.BzzAddress.Overlay)
}) })
h.Network().SetConnHandler(func(_ network.Conn) { h.Network().SetConnHandler(func(_ network.Conn) {
...@@ -531,7 +533,8 @@ func (s *Service) Connect(ctx context.Context, addr ma.Multiaddr) (address *bzz. ...@@ -531,7 +533,8 @@ func (s *Service) Connect(ctx context.Context, addr ma.Multiaddr) (address *bzz.
s.protocolsmu.RUnlock() s.protocolsmu.RUnlock()
s.metrics.CreatedConnectionCount.Inc() s.metrics.CreatedConnectionCount.Inc()
s.logger.Infof("successfully connected to peer (outbound) %s", i.BzzAddress.ShortString()) s.logger.Debugf("successfully connected to peer %s (outbound)", i.BzzAddress.ShortString())
s.logger.Infof("successfully connected to peer %s (outbound)", i.BzzAddress.Overlay)
return i.BzzAddress, nil return i.BzzAddress, nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment