Add debug option

This commit is contained in:
Yohann D'ANELLO 2021-01-01 18:14:22 +01:00
parent 9ef3be22e8
commit b70fbc75d1
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
2 changed files with 5 additions and 2 deletions

View File

@ -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:

View File

@ -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