Skip to content

Commit

Permalink
Fix ssh reconnect logs
Browse files Browse the repository at this point in the history
  • Loading branch information
amalshaji committed Nov 15, 2024
1 parent 72f67c4 commit 5ce4f1c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tunnel/internal/client/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,15 +379,15 @@ func (s *SshClient) StartHealthCheck(ctx context.Context) {
}

if s.config.Debug {
s.log.Error("health check failed", "error", err)
log.Error("Health check failed", "error", err)
}

fmt.Printf(color.Yellow("Tunnel %s is not healthy 🪫 attempting to reconnect\n"), s.config.GetTunnelAddr())

err = s.Reconnect()
if err != nil {
if s.config.Debug {
s.log.Error("failed to reconnect to ssh tunnel", "error", err, "attempts", retryAttempts)
log.Error("Failed to reconnect to ssh tunnel", "error", err, "attempts", retryAttempts)
}
} else {
retryAttempts = 0
Expand Down Expand Up @@ -423,7 +423,7 @@ func (s *SshClient) Reconnect() error {
if s.client != nil {
if err := s.client.Close(); err != nil {
if s.config.Debug {
s.log.Error("failed to close client", "error", err)
log.Error("Failed to close client", "error", err)
}
}
s.client = nil
Expand All @@ -432,7 +432,7 @@ func (s *SshClient) Reconnect() error {
if s.listener != nil {
if err := s.listener.Close(); err != nil {
if s.config.Debug {
s.log.Error("failed to close listener", "error", err)
log.Error("Failed to close listener", "error", err)
}
}
s.listener = nil
Expand Down Expand Up @@ -468,7 +468,7 @@ func (s *SshClient) HealthCheck() error {

if err != nil {
if s.config.Debug {
s.log.Error("health check failed, attempting to reconnect", "error", err)
log.Error("Health check failed, attempting to reconnect", "error", err)
}
return err
}
Expand Down

0 comments on commit 5ce4f1c

Please sign in to comment.