From 0d507f3a10c7b5b8bf9f3d926b4ab95371f4029a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Compagnon?= Date: Sun, 15 Mar 2026 00:01:45 +0100 Subject: [PATCH 1/2] feat(config): support LOGLEVEL env var as shorthand for LOGLEVEL_GENERAL Add support for the LOGLEVEL environment variable to set the general log level. LOGLEVEL_GENERAL remains supported for backward compatibility and takes priority if both are set. --- config.py | 7 +++++++ config.yaml | 1 + 2 files changed, 8 insertions(+) diff --git a/config.py b/config.py index 1c737fe..1de598e 100644 --- a/config.py +++ b/config.py @@ -218,6 +218,13 @@ def apply_overrides(config, prefix=''): apply_overrides(config) + # Support LOGLEVEL as a shorthand for LOGLEVEL_GENERAL (backward compatible) + loglevel_env = os.environ.get("LOGLEVEL") + if loglevel_env is not None and "logLevel" in config: + # LOGLEVEL_GENERAL takes priority over LOGLEVEL if both are set + if "LOGLEVEL_GENERAL" not in {k.upper() for k in os.environ}: + config["logLevel"]["general"] = loglevel_env + def init_loggers(config: Config) -> logging.Logger: """ Initializes logging based on the configuration. diff --git a/config.yaml b/config.yaml index b0aa164..9248e13 100644 --- a/config.yaml +++ b/config.yaml @@ -20,6 +20,7 @@ docker: # Logging Configuration (Possible values : "DEBUG", "INFO", "WARN", "ERROR", "FATAL") logLevel: # General logging level for all libraries etc + # Environment variable: LOGLEVEL (or LOGLEVEL_GENERAL for backward compatibility) general: "INFO" # This application specific logging level application: "DEBUG" From 99a2ce64f07d40b50b7063a5a55c33aba416d5c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Compagnon?= Date: Sun, 15 Mar 2026 00:04:15 +0100 Subject: [PATCH 2/2] docs: document LOGLEVEL env var in README and CLAUDE.md --- CLAUDE.md | 2 +- README.md | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 569ac42..3de9b71 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -54,7 +54,7 @@ The entire application is two Python files: Three-layer priority (lowest to highest): `config.yaml` → environment variables → CLI arguments. -Environment variables use `_` as separator (e.g., `DOCKER_HOST`, `TRAEFIK_CONTAINERNAME`). CLI arguments use `.` separator with `--` prefix (e.g., `--docker.host`, `--traefik.containername`). +Environment variables use `_` as separator (e.g., `DOCKER_HOST`, `TRAEFIK_CONTAINERNAME`). CLI arguments use `.` separator with `--` prefix (e.g., `--docker.host`, `--traefik.containername`). The general log level can be set via the shorthand `LOGLEVEL` env var (`LOGLEVEL_GENERAL` is also supported for backward compatibility). ## Versioning & CI/CD diff --git a/README.md b/README.md index 10c403a..d4dc35c 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,7 @@ CLI arguments > environment variables > config.yaml | --- | --- | --- | --- | | Traefik container name | `TRAEFIK_CONTAINERNAME` | `--traefik.containername` | `traefik` | | Docker socket/host | `DOCKER_HOST` | `--docker.host` | Unix socket | +| General log level | `LOGLEVEL` | `--loglevel.general` | `INFO` | | App log level | `LOGLEVEL_APPLICATION` | `--loglevel.application` | `DEBUG` | | Monitored label (regex) | `TRAEFIK_MONITOREDLABEL` | `--traefik.monitoredlabel` | `^traefik.enable$` | | Network label | `TRAEFIK_NETWORKLABEL` | `--traefik.networklabel` | `traefik.docker.network` | @@ -138,7 +139,7 @@ docker: key: "/path/to/key.pem" logLevel: - general: "INFO" # third-party libraries + general: "INFO" # third-party libraries (env: LOGLEVEL or LOGLEVEL_GENERAL) application: "DEBUG" # this daemon traefik: