diff --git a/bar/main.py b/bar/main.py index 6c6fc5e..cd752c8 100644 --- a/bar/main.py +++ b/bar/main.py @@ -6,10 +6,10 @@ if DEV: # In dev mode, disable fabric logs but keep stylix and bar logs logger.disable("fabric") else: - # In production, disable all debug logs, only keep warnings and errors + # In production, disable fabric logs but keep bar logs for debugging + import sys logger.disable("fabric") - logger.disable("bar") - logger.configure(handlers=[{"sink": lambda msg: print(msg, end=""), "level": "WARNING"}]) + logger.configure(handlers=[{"sink": sys.stderr, "level": "INFO", "format": "{time} | {level} | {name}:{function}:{line} - {message}"}]) from fabric import Application from fabric.system_tray.widgets import SystemTray diff --git a/bar/modules/calendar.py b/bar/modules/calendar.py index f5f9447..9da08eb 100644 --- a/bar/modules/calendar.py +++ b/bar/modules/calendar.py @@ -132,24 +132,28 @@ class CalendarService: return try: + cmd = [ + khal_path, + "list", + "--json", + "title", + "--json", + "start", + "--json", + "end", + "--json", + "location", + "today", + ] + logger.info(f"[Calendar] Running command: {' '.join(cmd)}") result = subprocess.run( - [ - khal_path, - "list", - "--json", - "title", - "--json", - "start", - "--json", - "end", - "--json", - "location", - "today", - ], + cmd, capture_output=True, text=True, check=True, ) + logger.info(f"[Calendar] Command stdout: {result.stdout[:200]}...") + logger.info(f"[Calendar] Command stderr: {result.stderr[:200]}...") if result.stdout.strip(): lines = result.stdout.strip().split("\n") diff --git a/bar/modules/notmuch.py b/bar/modules/notmuch.py index ee50d60..61366ff 100644 --- a/bar/modules/notmuch.py +++ b/bar/modules/notmuch.py @@ -82,12 +82,16 @@ class NotmuchService: try: # Get unread email count + cmd = [notmuch_path, "count", "tag:unread"] + logger.info(f"[Notmuch] Running command: {' '.join(cmd)}") result = subprocess.run( - [notmuch_path, "count", "tag:unread"], + cmd, capture_output=True, text=True, check=True, ) + logger.info(f"[Notmuch] Command stdout: '{result.stdout.strip()}'") + logger.info(f"[Notmuch] Command stderr: '{result.stderr.strip()}'") if result.stdout.strip(): self.unread_count = int(result.stdout.strip()) @@ -146,8 +150,10 @@ class NotmuchWidget(Button): try: # Open emacsclient with notmuch function - subprocess.Popen([emacsclient_command, "-c", "-e", "(notmuch)"], start_new_session=True) - logger.info(f"[Notmuch] Opened notmuch in emacsclient with command: {emacsclient_command}") + cmd = [emacsclient_command, "-c", "-e", "(notmuch)"] + logger.info(f"[Notmuch] Running emacsclient command: {' '.join(cmd)}") + subprocess.Popen(cmd, start_new_session=True) + logger.info(f"[Notmuch] Successfully started emacsclient process") except Exception as e: logger.error(f"[Notmuch] Failed to open notmuch in emacsclient '{emacsclient_command}': {e}")