Skip to content

Commit

Permalink
chore: improve error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulghangas committed Jul 19, 2021
1 parent 7e6d2b7 commit dbde36d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions transport/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ func (t *Transport) dial(retryCtx context.Context, remote id.Signatory, remoteAd
}
},
func(err error) {
t.opts.Logger.Error("dial", zap.String("remote", remote.String()), zap.String("addr", remoteAddr.String()), zap.Error(err))
t.opts.Logger.Debug("dial", zap.String("remote", remote.String()), zap.String("addr", remoteAddr.String()), zap.Error(err))
t.table.AddExpiry(remote, t.opts.ExpiryDuration)
if t.table.HandleExpired(remote) {
t.Unlink(remote)
Expand All @@ -362,7 +362,7 @@ func (t *Transport) dial(retryCtx context.Context, remote id.Signatory, remoteAd
},
t.opts.DialTimeout)
if err != nil {
t.opts.Logger.Error("dial", zap.String("remote", remote.String()), zap.String("addr", remoteAddr.String()), zap.Error(err))
t.opts.Logger.Debug("dial", zap.String("remote", remote.String()), zap.String("addr", remoteAddr.String()), zap.Error(err))
select {
case <-exit:
break
Expand All @@ -377,6 +377,10 @@ func (t *Transport) dial(retryCtx context.Context, remote id.Signatory, remoteAd
} else {
t.table.DeleteExpiry(remote)
}

if !t.IsConnected(remote) {
t.opts.Logger.Error("dial", zap.String("remote", remote.String()), zap.String("addr", remoteAddr.String()), zap.Error(fmt.Errorf("failed to connect")))
}
// Cancel last dial context before exiting
cancel()
return
Expand Down

0 comments on commit dbde36d

Please sign in to comment.