Add --quiet mode

Add a mode that decreases the log level to WARNING. In case the
conflicting options -d and -q are given simultaneously, -d will win.
This commit is contained in:
Sebastian Spaeth 2023-11-15 10:13:49 +01:00
parent 7b62b49df4
commit 2f2eee20d6

View File

@ -201,10 +201,13 @@ def parse_options() -> argparse.Namespace:
help="Also include local (ie, from *our* users) media files when purging.")
parser.add_argument('-n', '--dryrun', action='store_true',
help="Dry run (don't actually modify any files).")
parser.add_argument('-d', '--debug', action='store_true', help="Turn debug output on.")
parser.add_argument('-q', '--quiet', action='store_true', help="Reduce output verbosity.")
parser.add_argument('-d', '--debug', action='store_true', help="Increase output verbosity.")
args: argparse.Namespace = parser.parse_args()
if args.debug:
loglevel = logging.DEBUG
elif args.quiet:
loglevel = logging.WARNING
logging.basicConfig(level=loglevel, format='%(levelname)s - %(message)s')
return args