Add CLI log level override for docker exporter
This commit is contained in:
@@ -372,8 +372,31 @@ def dump_service_image_mapping():
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser(description="Docker image update exporter")
|
parser = argparse.ArgumentParser(description="Docker image update exporter")
|
||||||
parser.add_argument("--dry-run", action="store_true", help="Only print service->image mapping and exit")
|
parser.add_argument("--dry-run", action="store_true", help="Only print service->image mapping and exit")
|
||||||
|
parser.add_argument(
|
||||||
|
"--services-up-script",
|
||||||
|
default=SERVICES_UP_SCRIPT,
|
||||||
|
help=f"Path to services-up script (default: {SERVICES_UP_SCRIPT})",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--cache-file",
|
||||||
|
default=CACHE_FILE,
|
||||||
|
help=f"Path to digest cache file (default: {CACHE_FILE})",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--log-level",
|
||||||
|
default=LOG_LEVEL,
|
||||||
|
help=f"Logging level (default: {LOG_LEVEL})",
|
||||||
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
effective_log_level = str(args.log_level).upper()
|
||||||
|
logging.getLogger().setLevel(getattr(logging, effective_log_level, logging.DEBUG))
|
||||||
|
logger.setLevel(getattr(logging, effective_log_level, logging.DEBUG))
|
||||||
|
|
||||||
|
SERVICES_UP_SCRIPT = args.services_up_script
|
||||||
|
CACHE_FILE = args.cache_file
|
||||||
|
REMOTE_DIGEST_CACHE = load_cache()
|
||||||
|
|
||||||
if DRY_RUN or args.dry_run:
|
if DRY_RUN or args.dry_run:
|
||||||
dump_service_image_mapping()
|
dump_service_image_mapping()
|
||||||
raise SystemExit(0)
|
raise SystemExit(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user