refactor(src/shared): replace print statements with logger.error

Use centralized logging instead of stdout prints to improve observability and consistency
This commit is contained in:
sankalp committed 2026-06-17 05:21:02 +05:45
1 parent 48231b3bc2
commit 1aed6ea816
6 files changed
+26 -20

No files matched your search

+4 -1
View File
@@ -1,3 +1,4 @@
from fabric.utils import logger
from fabric.utils import GLib
from fabric.widgets.eventbox import EventBox # noqa: E402
from fabric.widgets.wayland import WaylandWindow as Window # noqa: E402
@@ -51,7 +52,9 @@ class AppletWindow(PopupWindow):
else:
active.hide()
except Exception as e:
print(f"[AppletWindow] Warning: failed to close active popup: {e}")
logger.error(
f"[AppletWindow] Warning: failed to close active popup: {e}"
)
AppletWindow._active_popup = self
+3 -2
View File
@@ -1,3 +1,4 @@
from fabric.utils import logger
from fabric.utils import GLib
from fabric.widgets.box import Box
from fabric.widgets.button import Button
@@ -125,7 +126,7 @@ class GameModeButton(Box):
toggle_gamemode()
GLib.timeout_add(500, lambda: self.update_state())
except Exception as e:
print(f"Failed to toggle game mode: {e}")
logger.error(f"Failed to toggle game mode: {e}")
GLib.timeout_add(300, lambda: self._reset_icon_state())
@@ -140,7 +141,7 @@ class GameModeButton(Box):
else:
self.game_icon.remove_style_class("connected")
except Exception as e:
print(f"Failed to check game mode status: {e}")
logger.error(f"Failed to check game mode status: {e}")
self.game_icon.remove_style_class("connected")
return False # Remove timeout if called from GLib.timeout_add
+3 -2
View File
@@ -1,3 +1,4 @@
from fabric.utils import logger
from fabric.widgets.box import Box
from fabric.widgets.centerbox import CenterBox
from fabric.widgets.eventbox import EventBox
@@ -87,7 +88,7 @@ class ModusDropdown(AppletWindow):
try:
modus_service.disconnect_by_func(self.hide_dropdown)
except Exception:
pass
except Exception as e:
logger.error(f"An error occurred: {e}")
super().destroy()
+5 -5
View File
@@ -1,4 +1,4 @@
from fabric.utils import Gdk, GLib, Gtk
from fabric.utils import Gdk, GLib, Gtk, logger
from fabric.widgets.wayland import WaylandWindow
from gi.repository import GtkLayerShell
@@ -51,8 +51,8 @@ class PopupWindow(WaylandWindow):
if self._pointing_widget:
try:
self._pointing_widget.disconnect_by_func(self.do_handle_size_allocate)
except Exception:
pass
except Exception as e:
logger.error(f"An error occurred: {e}")
self._pointing_widget = widget
return self.do_update_handlers()
@@ -74,8 +74,8 @@ class PopupWindow(WaylandWindow):
try:
self._pointing_widget.disconnect_by_func(self.do_handle_size_allocate)
self.disconnect_by_func(self.do_handle_size_allocate)
except Exception:
pass
except Exception as e:
logger.error(f"An error occurred: {e}")
return
self._pointing_widget.connect("size-allocate", self.do_handle_size_allocate)