diff --git a/bar/config.py b/bar/config.py index 28fd5fc..4b903e3 100644 --- a/bar/config.py +++ b/bar/config.py @@ -56,4 +56,5 @@ STYLIX = app_config.get("stylix", {"enable": False}) CALENDAR = app_config.get("calendar", {"enable": True, "khal_path": "khal"}) NOTMUCH = app_config.get("notmuch", {"enable": True, "notmuch_path": "notmuch", "emacsclient_command": "emacsclient"}) BAR_HEIGHT = app_config.get("height", 40) +LOG_LEVEL = app_config.get("logLevel", "WARNING") DEV = app_config.get("dev", False) diff --git a/bar/main.py b/bar/main.py index cd752c8..20f36cf 100644 --- a/bar/main.py +++ b/bar/main.py @@ -1,15 +1,15 @@ from loguru import logger # Configure logging based on dev flag -from .config import DEV +from .config import DEV, LOG_LEVEL if DEV: # In dev mode, disable fabric logs but keep stylix and bar logs logger.disable("fabric") else: - # In production, disable fabric logs but keep bar logs for debugging + # In production, disable fabric logs but keep bar logs with configurable level import sys logger.disable("fabric") - logger.configure(handlers=[{"sink": sys.stderr, "level": "INFO", "format": "{time} | {level} | {name}:{function}:{line} - {message}"}]) + logger.configure(handlers=[{"sink": sys.stderr, "level": LOG_LEVEL, "format": "{time} | {level} | {name}:{function}:{line} - {message}"}]) from fabric import Application from fabric.system_tray.widgets import SystemTray diff --git a/flake.nix b/flake.nix index 98e3da5..7f4b4e3 100644 --- a/flake.nix +++ b/flake.nix @@ -88,6 +88,11 @@ default = 40; description = "Height of the status bar in pixels"; }; + logLevel = lib.mkOption { + type = lib.types.enum [ "TRACE" "DEBUG" "INFO" "SUCCESS" "WARNING" "ERROR" "CRITICAL" ]; + default = "WARNING"; + description = "Log level for the status bar (loguru levels: TRACE, DEBUG, INFO, SUCCESS, WARNING, ERROR, CRITICAL)"; + }; window_title = { enable = lib.mkOption { type = lib.types.bool; @@ -135,6 +140,7 @@ vinyl.enable = false; battery.enable = false; height = 40; + logLevel = "WARNING"; window_title.enable = true; stylix.enable = false; calendar = {