From 46effe1fe6fee297ebc1e4b76b581962a9343f94 Mon Sep 17 00:00:00 2001 From: amcmanu3 Date: Tue, 14 Feb 2023 14:44:53 -0500 Subject: [PATCH] Only use verbose console if user add -v flag --- app/classes/shared/console.py | 7 +++++-- main.py | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/classes/shared/console.py b/app/classes/shared/console.py index 84362032..2c463e5a 100644 --- a/app/classes/shared/console.py +++ b/app/classes/shared/console.py @@ -19,6 +19,8 @@ except ModuleNotFoundError as ex: class Console: + level = "" + def __init__(self): if "colorama" in sys.modules: init() @@ -61,8 +63,9 @@ class Console: @staticmethod def debug(message): - date_time = Console.get_fmt_date_time() - Console.magenta(f"[+] Crafty: {date_time} - DEBUG:\t{message}") + if Console.level == "debug": + date_time = Console.get_fmt_date_time() + Console.magenta(f"[+] Crafty: {date_time} - DEBUG:\t{message}") @staticmethod def info(message): diff --git a/main.py b/main.py index 5f05390e..9cf66b11 100644 --- a/main.py +++ b/main.py @@ -102,6 +102,9 @@ if __name__ == "__main__": setup_logging(debug=args.verbose) + if args.verbose: + Console.level = "debug" + # setting up the logger object logger = logging.getLogger(__name__) Console.cyan(f"Logging set to: {logger.level}")