From e7a6b7f0bd0c83c460f0950fb8eba26da826b396 Mon Sep 17 00:00:00 2001 From: Ryan Luu Date: Mon, 19 Aug 2024 20:41:06 +0000 Subject: [PATCH] Add quiet logging --- src/instawebhooks/__main__.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/instawebhooks/__main__.py b/src/instawebhooks/__main__.py index 67d9137..0b37d0a 100644 --- a/src/instawebhooks/__main__.py +++ b/src/instawebhooks/__main__.py @@ -58,6 +58,7 @@ def closure_check_regex(arg_value): description="Monitor Instagram accounts for new posts and send them to a Discord webhook", epilog="https://github.com/RaenLua/InstaWebhooks", ) +group = parser.add_mutually_exclusive_group() parser.add_argument( "instagram_username", help="the Instagram username to monitor for new posts", @@ -70,9 +71,8 @@ def closure_check_regex(arg_value): r"^.*(discord|discordapp)\.com\/api\/webhooks\/([\d]+)\/([a-zA-Z0-9_.-]*)$" ), ) -parser.add_argument( - "-v", "--verbose", help="increase output verbosity", action="store_true" -) +group.add_argument("-q", "--quiet", help="hide all logging", action="store_true") +group.add_argument("-v", "--verbose", help="show debug logging", action="store_true") parser.add_argument( "-i", "--refresh-interval", @@ -97,9 +97,14 @@ def closure_check_regex(arg_value): args = parser.parse_args() # Set the logger to debug if verbose is enabled -if args.verbose: +if args.quiet: + logger.setLevel(logging.CRITICAL) + logger.debug("Quiet output enabled.") +elif args.verbose: logger.setLevel(logging.DEBUG) logger.debug("Verbose output enabled.") +else: + logger.setLevel(logging.INFO) # Log the start of the program logger.info("Starting InstaWebhooks...")