Now print exceptions to console when SSH connection is lost

This commit is contained in:
David J. Bianco
2025-01-28 10:21:27 -05:00
parent cea5dc28a2
commit 788bd26845

View File

@ -8,6 +8,7 @@ import threading
import sys
import json
import os
import traceback
from typing import Optional
import logging
import datetime
@ -63,6 +64,7 @@ class MySSHServer(asyncssh.SSHServer):
def connection_lost(self, exc: Optional[Exception]) -> None:
if exc:
logger.error('SSH connection error', extra={"error": str(exc)})
traceback.print_exception(exc)
else:
logger.info("SSH connection closed")
# Ensure session summary is called on connection loss if attributes are set