feat: add loglevel as command line arguments

- add new argument "--loglevel"
- set loglevel based on the argument if provided
  - otherwise use the value from the config file

🤖
This commit is contained in:
Sebastian Mark 2023-12-21 15:55:58 +01:00
parent db6fd25741
commit a2e5852159

3
dc-ops
View file

@ -21,11 +21,14 @@ with configfile.open("r") as f:
# fmt: off
parser = argparse.ArgumentParser()
parser.add_argument("--ignore-git-status", action="store_true", help="continue even if there are no new commits") # noqa
parser.add_argument("--loglevel", help="set loglevel (overrides config file)")
args = parser.parse_args()
# fmt: on
# init logging
loglevel = cfg.get("loglevel", "INFO").upper()
if args.loglevel:
loglevel = args.loglevel
log.basicConfig(format="%(message)s", level=loglevel)
# define docker compose parameters