From a2e58521594ce04b26d34f934da4f540bf5438a0 Mon Sep 17 00:00:00 2001 From: Sebastian Mark Date: Thu, 21 Dec 2023 15:55:58 +0100 Subject: [PATCH] feat: add loglevel as command line arguments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - add new argument "--loglevel" - set loglevel based on the argument if provided - otherwise use the value from the config file 🤖 --- dc-ops | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dc-ops b/dc-ops index 6c183f2..aa350dc 100755 --- a/dc-ops +++ b/dc-ops @@ -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