From 2beb848f3dc3f7a1c92ab74eaf805141cccff063 Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Mon, 28 Oct 2019 14:27:51 +0100 Subject: [PATCH] Implement --quiet This program is quite verbose in it's regular running form, so this implements a --quiet flag which lowers the log-level to WARNING, getting rid of all the normal status messages, and will only say something if something unexpected happens. Signed-off-by: Anton Lundin --- docker_custodian/docker_gc.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docker_custodian/docker_gc.py b/docker_custodian/docker_gc.py index dffcd03..6b06080 100644 --- a/docker_custodian/docker_gc.py +++ b/docker_custodian/docker_gc.py @@ -298,6 +298,9 @@ def main(): timeout=args.timeout, **kwargs_from_env()) + if args.quiet: + log.setLevel(logging.WARNING) + exclude_container_labels = format_exclude_labels( args.exclude_container_label ) @@ -322,6 +325,10 @@ def main(): def get_args(args=None): parser = argparse.ArgumentParser() + parser.add_argument( + '-q', '--quiet', + action="store_true", + help="Quiet down program, only print warnings and errors") parser.add_argument( '--max-container-age', type=timedelta_type,