raise HostConnectionError(msg, host, addr)
except asyncssh.Error as e:
self.mgr.offline_hosts.add(host)
- log_content = log_string.getvalue()
- msg = f'Failed to connect to {host} ({addr}). {str(e)}' + '\n' + f'Log: {log_content}'
+ log_content = ''
+ if asyncssh_logger.getEffectiveLevel() == logging.DEBUG:
+ log_content = '\n' + f'Log: {log_string.getvalue()}'
+ msg = f'Failed to connect to {host} ({addr}). {str(e)}{log_content}'
- logger.debug(msg)
+ logger.exception(msg)
raise HostConnectionError(msg, host, addr)
except Exception as e:
self.mgr.offline_hosts.add(host)