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

View File

@ -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}")