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"})
|
||||
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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user