From aea800cedcbd686419b34a4837efa9c0e0890cb4 2024-05-09 21:08:54 From: x Date: 2024-05-09 21:08:54 Subject: [PATCH] fix: clean up console logging --- diff --git a/backend/generic_handler.py b/backend/generic_handler.py index ec83369d1c94e9c38e0ae3fc216ea0c35b3a15c1..611730a11536c6456577c1a627802dd1bca84c3e 100644 --- a/backend/generic_handler.py +++ b/backend/generic_handler.py @@ -46,8 +46,8 @@ class Verificator: elif e.verify_code == ROOT_NOT_TRUSTED: return TLSDetails(domain_name=domain, error_message="invalid: root not trusted.") else: - return TLSDetails(domain_name=domain, error_message="failed verification: " + e.verify_message + ".") + return TLSDetails(domain_name=domain, error_message="failed verification: " + e.verify_message) except ssl.SSLError as e: - return TLSDetails(domain_name=domain, error_message="could not establish a secure connection: " + e.reason + ".") + return TLSDetails(domain_name=domain, error_message="could not establish a secure connection: " + e.reason) except Exception as e: - return TLSDetails(domain_name=domain, error_message="could not connect: " + str(e) + ".") \ No newline at end of file + return TLSDetails(domain_name=domain, error_message="could not connect: " + str(e)) \ No newline at end of file diff --git a/backend/tls_utils.py b/backend/tls_utils.py index b5067c780747d466fbfa69f4c752db367300afaa..c7b0d027a603f8b5105b4dbdbac116c9353fcb25 100644 --- a/backend/tls_utils.py +++ b/backend/tls_utils.py @@ -22,13 +22,13 @@ class TLSDetails: def print(self, console: Console): if self.connection_error: - console.log("[orange bold underline]" + self.domain_name, self.error_message, style="orange") + console.log("[bold underline]" + self.domain_name, self.error_message, style="orange") elif self.error_message != None: - console.log("[red bold underline]" + self.domain_name, self.error_message, style="red") + console.log("[bold underline]" + self.domain_name, self.error_message, style="red") elif self.expires_in_days < 0: - console.log("[red bold underline]" + self.domain_name, "expired", abs(self.expires_in_days), "days ago.", style="red") + console.log("[bold underline]" + self.domain_name, "expired", abs(self.expires_in_days), "days ago.", style="red") else: - console.log("[green bold underline]" + self.domain_name, "expires in", self.expires_in_days, "days", style="green") + console.log("[bold underline]" + self.domain_name, "expires in", self.expires_in_days, "days", style="green") def compare_expiry_timestamps(expiry_timestamp: int, now_timestamp: int = datetime.datetime.now(datetime.UTC).timestamp()) -> tuple[bool, int]: seconds_left = expiry_timestamp - now_timestamp