feat: log level in nix
This commit is contained in:
@@ -56,4 +56,5 @@ STYLIX = app_config.get("stylix", {"enable": False})
|
|||||||
CALENDAR = app_config.get("calendar", {"enable": True, "khal_path": "khal"})
|
CALENDAR = app_config.get("calendar", {"enable": True, "khal_path": "khal"})
|
||||||
NOTMUCH = app_config.get("notmuch", {"enable": True, "notmuch_path": "notmuch", "emacsclient_command": "emacsclient"})
|
NOTMUCH = app_config.get("notmuch", {"enable": True, "notmuch_path": "notmuch", "emacsclient_command": "emacsclient"})
|
||||||
BAR_HEIGHT = app_config.get("height", 40)
|
BAR_HEIGHT = app_config.get("height", 40)
|
||||||
|
LOG_LEVEL = app_config.get("logLevel", "WARNING")
|
||||||
DEV = app_config.get("dev", False)
|
DEV = app_config.get("dev", False)
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
# Configure logging based on dev flag
|
# Configure logging based on dev flag
|
||||||
from .config import DEV
|
from .config import DEV, LOG_LEVEL
|
||||||
if DEV:
|
if DEV:
|
||||||
# In dev mode, disable fabric logs but keep stylix and bar logs
|
# In dev mode, disable fabric logs but keep stylix and bar logs
|
||||||
logger.disable("fabric")
|
logger.disable("fabric")
|
||||||
else:
|
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
|
import sys
|
||||||
logger.disable("fabric")
|
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 import Application
|
||||||
from fabric.system_tray.widgets import SystemTray
|
from fabric.system_tray.widgets import SystemTray
|
||||||
|
|||||||
@@ -88,6 +88,11 @@
|
|||||||
default = 40;
|
default = 40;
|
||||||
description = "Height of the status bar in pixels";
|
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 = {
|
window_title = {
|
||||||
enable = lib.mkOption {
|
enable = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
@@ -135,6 +140,7 @@
|
|||||||
vinyl.enable = false;
|
vinyl.enable = false;
|
||||||
battery.enable = false;
|
battery.enable = false;
|
||||||
height = 40;
|
height = 40;
|
||||||
|
logLevel = "WARNING";
|
||||||
window_title.enable = true;
|
window_title.enable = true;
|
||||||
stylix.enable = false;
|
stylix.enable = false;
|
||||||
calendar = {
|
calendar = {
|
||||||
|
|||||||
Reference in New Issue
Block a user