Only use verbose console if user add -v flag

This commit is contained in:
amcmanu3 2023-02-14 14:44:53 -05:00
parent c434833208
commit 46effe1fe6
2 changed files with 8 additions and 2 deletions

View File

@ -19,6 +19,8 @@ except ModuleNotFoundError as ex:
class Console: class Console:
level = ""
def __init__(self): def __init__(self):
if "colorama" in sys.modules: if "colorama" in sys.modules:
init() init()
@ -61,6 +63,7 @@ class Console:
@staticmethod @staticmethod
def debug(message): def debug(message):
if Console.level == "debug":
date_time = Console.get_fmt_date_time() date_time = Console.get_fmt_date_time()
Console.magenta(f"[+] Crafty: {date_time} - DEBUG:\t{message}") Console.magenta(f"[+] Crafty: {date_time} - DEBUG:\t{message}")

View File

@ -102,6 +102,9 @@ if __name__ == "__main__":
setup_logging(debug=args.verbose) setup_logging(debug=args.verbose)
if args.verbose:
Console.level = "debug"
# setting up the logger object # setting up the logger object
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
Console.cyan(f"Logging set to: {logger.level}") Console.cyan(f"Logging set to: {logger.level}")