Skip to content

Commit

Permalink
Add quiet logging
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanLua authored Aug 19, 2024
1 parent f7c71ef commit e7a6b7f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/instawebhooks/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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...")
Expand Down

0 comments on commit e7a6b7f

Please sign in to comment.