Skip to content

Commit

Permalink
Implement --quiet
Browse files Browse the repository at this point in the history
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 <glance@acc.umu.se>
  • Loading branch information
glance- committed Oct 28, 2019
1 parent cc0fdbb commit 2beb848
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docker_custodian/docker_gc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -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,
Expand Down

0 comments on commit 2beb848

Please sign in to comment.