diff --git a/stactask/task.py b/stactask/task.py index 6425df4..cb4938d 100644 --- a/stactask/task.py +++ b/stactask/task.py @@ -461,6 +461,22 @@ def _post_process_item(self, item: dict[str, Any]) -> dict[str, Any]: item["stac_extensions"].sort() return item + @classmethod + def configure_logging(cls, loglevel: str) -> None: + """Configures logging.""" + logging.basicConfig(level=loglevel) + + # quiet these loud loggers + for ql in [ + "botocore", + "s3transfer", + "urllib3", + "fsspec", + "asyncio", + "aiobotocore", + ]: + logging.getLogger(ql).propagate = False + @classmethod def handler(cls, payload: dict[str, Any], **kwargs: Any) -> dict[str, Any]: task = None @@ -612,7 +628,7 @@ def parse_args(cls, args: list[str]) -> dict[str, Any]: if pargs.get("output") is None: pargs["output"] = Path(pargs["workdir"]) / "output-payload.json" - if pargs.get("command", None) is None: + if pargs.get("command") is None: parser.print_help() sys.exit(0) @@ -625,18 +641,7 @@ def cli(cls) -> None: # logging loglevel = args.pop("logging") - logging.basicConfig(level=loglevel) - - # quiet these loud loggers - for ql in [ - "botocore", - "s3transfer", - "urllib3", - "fsspec", - "asyncio", - "aiobotocore", - ]: - logging.getLogger(ql).propagate = False + cls.configure_logging(loglevel) if cmd == "run": href = args.pop("input", None)