Add verbose logging

This commit is contained in:
Ben 2022-03-18 15:41:25 +01:00
parent fa1596b57a
commit 816ddb12b0
Signed by: ben
GPG key ID: 0F54A7ED232D3319

View file

@ -17,6 +17,8 @@ def resolve_image_units():
services_list = list(map(lambda p: str(p.name), services_path.iterdir())) services_list = list(map(lambda p: str(p.name), services_path.iterdir()))
image_units: Set[str] = set() image_units: Set[str] = set()
logging.info(f"Found {len(services_list)} services: {str(services_list)}")
def process_pod_systemctl_show(line: str): def process_pod_systemctl_show(line: str):
search_str = "Wants=" search_str = "Wants="
if line.startswith(search_str): if line.startswith(search_str):
@ -61,11 +63,19 @@ def resolve_image_units():
bar.length += len(new_image_units) bar.length += len(new_image_units)
previous_image_units = set(image_units) previous_image_units = set(image_units)
logging.info(f"Found {len(image_units)} images: {str(image_units)}")
return image_units return image_units
def main(): @click.command()
logging.basicConfig(level=logging.CRITICAL) @click.option("--verbose", is_flag=True, default=False, help="Enable INFO logging")
def main(verbose):
if verbose:
loglevel = logging.INFO
else:
loglevel = logging.CRITICAL
logging.basicConfig(level=loglevel)
image_units = resolve_image_units() image_units = resolve_image_units()
image_tags: Set[str] = set() image_tags: Set[str] = set()