From b70fbc75d18e579f63a3f9903b36413222bbc508 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Fri, 1 Jan 2021 18:14:22 +0100 Subject: [PATCH] Add debug option --- squinnondation/hazel.py | 4 ++-- squinnondation/squinnondation.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/squinnondation/hazel.py b/squinnondation/hazel.py index 4039321..00988ca 100644 --- a/squinnondation/hazel.py +++ b/squinnondation/hazel.py @@ -389,9 +389,9 @@ class Squirrel(Hazelnut): def add_system_message(self, msg: str) -> None: """ Add a new system log message. - TODO: Configure logging levels to ignore some messages. """ - return self.add_message(f"system: *{msg}*" if not self.squinnondation.no_markdown else f"system: {msg}") + if self.squinnondation.debug: + return self.add_message(f"system: *{msg}*" if not self.squinnondation.no_markdown else f"system: {msg}") def print_markdown(self, pad: Any, y: int, x: int, msg: str, bold: bool = False, italic: bool = False, underline: bool = False, strike: bool = False) -> int: diff --git a/squinnondation/squinnondation.py b/squinnondation/squinnondation.py index 80d9175..b0d959d 100644 --- a/squinnondation/squinnondation.py +++ b/squinnondation/squinnondation.py @@ -16,6 +16,7 @@ class Squinnondation: bind_port: int no_emoji: bool no_markdown: bool + debug: bool screen: Any def parse_arguments(self) -> None: @@ -32,6 +33,7 @@ class Squinnondation: help="Don't replace emojis.") parser.add_argument('--no-markdown', '-nm', action='store_true', help="Don't replace emojis.") + parser.add_argument('--debug', '-d', action='store_true', help="Debug mode.") self.args = parser.parse_args() if not (1024 <= self.args.bind_port <= 65535) or\ @@ -42,6 +44,7 @@ class Squinnondation: self.bind_port = self.args.bind_port self.no_emoji = self.args.no_emoji self.no_markdown = self.args.no_markdown + self.debug = self.args.debug @staticmethod def main() -> None: # pragma: no cover