Turned Off Logging

This commit is contained in:
tr1x_em committed 2025-08-07 15:01:09 +05:30
1 parent b07b79796c
commit 37ef0b33be
2 files changed
+19 -11

No files matched your search

+7 -2
View File
@@ -1,11 +1,13 @@
import gi import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0') gi.require_version("Gtk", "3.0")
gi.require_version("Gdk", "3.0")
from gi.repository import Gtk, Gdk from gi.repository import Gtk, Gdk
# Initialize fontconfig early to prevent warnings # Initialize fontconfig early to prevent warnings
try: try:
import ctypes import ctypes
libfontconfig = ctypes.CDLL("libfontconfig.so.1") libfontconfig = ctypes.CDLL("libfontconfig.so.1")
libfontconfig.FcInit() libfontconfig.FcInit()
except: except:
@@ -36,6 +38,9 @@ for log in [
"utils.wayland", "utils.wayland",
"modules.notification.notification", "modules.notification.notification",
"modules.notification.notification_center", "modules.notification.notification_center",
"modules.controlcenter.player",
"services.brightness",
"modules.controlcenter.expanded_player",
]: ]:
logger.disable(log) logger.disable(log)
+12 -9
View File
@@ -7,6 +7,7 @@ import re
import threading import threading
import time import time
from typing import Dict, List, Optional from typing import Dict, List, Optional
from loguru import logger
from gi.repository import GdkPixbuf from gi.repository import GdkPixbuf
from PIL import Image from PIL import Image
@@ -60,9 +61,9 @@ class WallpaperPlugin(PluginBase):
[f for f in os.listdir(data.WALLPAPERS_DIR) if self._is_image(f)] [f for f in os.listdir(data.WALLPAPERS_DIR) if self._is_image(f)]
) )
else: else:
print(f"Wallpapers directory not found: {data.WALLPAPERS_DIR}") logger.error(f"Wallpapers directory not found: {data.WALLPAPERS_DIR}")
except Exception as e: except Exception as e:
print(f"Error loading wallpapers: {e}") logger.error(f"Error loading wallpapers: {e}")
def _is_image(self, filename: str) -> bool: def _is_image(self, filename: str) -> bool:
"""Check if file is a supported image format.""" """Check if file is a supported image format."""
@@ -81,7 +82,7 @@ class WallpaperPlugin(PluginBase):
# File doesn't exist, keep default True # File doesn't exist, keep default True
pass pass
except Exception as e: except Exception as e:
print(f"Error reading config file: {e}") logger.error(f"Error reading config file: {e}")
# Keep default True on error # Keep default True on error
return self.matugen_enabled return self.matugen_enabled
@@ -106,7 +107,7 @@ class WallpaperPlugin(PluginBase):
json.dump(config, f, indent=4) json.dump(config, f, indent=4)
except Exception as e: except Exception as e:
print(f"Error writing matugen state to config: {e}") logger.error(f"Error writing matugen state to config: {e}")
# Clear the search query after toggling matugen # Clear the search query after toggling matugen
self._clear_launcher_query() self._clear_launcher_query()
@@ -164,7 +165,7 @@ class WallpaperPlugin(PluginBase):
return return
except Exception as e: except Exception as e:
print(f"Could not clear launcher query: {e}") logger.error(f"Could not clear launcher query: {e}")
def _get_cache_path(self, filename: str) -> str: def _get_cache_path(self, filename: str) -> str:
"""Get cache path for wallpaper thumbnail.""" """Get cache path for wallpaper thumbnail."""
@@ -183,7 +184,7 @@ class WallpaperPlugin(PluginBase):
img.thumbnail((32, 32), Image.Resampling.LANCZOS) img.thumbnail((32, 32), Image.Resampling.LANCZOS)
img.save(cache_path, "PNG", optimize=True) img.save(cache_path, "PNG", optimize=True)
except Exception as e: except Exception as e:
print(f"Error creating thumbnail for {filename}: {e}") logger.error(f"Error creating thumbnail for {filename}: {e}")
return None return None
return cache_path return cache_path
@@ -205,12 +206,14 @@ class WallpaperPlugin(PluginBase):
) )
self.thumbnail_cache[wallpaper] = pixbuf self.thumbnail_cache[wallpaper] = pixbuf
except Exception as e: except Exception as e:
print(f"Error loading thumbnail for {wallpaper}: {e}") logger.error(
f"Error loading thumbnail for {wallpaper}: {e}"
)
self.thumbnail_cache[wallpaper] = None self.thumbnail_cache[wallpaper] = None
else: else:
self.thumbnail_cache[wallpaper] = None self.thumbnail_cache[wallpaper] = None
except Exception as e: except Exception as e:
print(f"Error processing thumbnail for {wallpaper}: {e}") logger.error(f"Error processing thumbnail for {wallpaper}: {e}")
self.thumbnail_cache[wallpaper] = None self.thumbnail_cache[wallpaper] = None
finally: finally:
self.thumbnail_loading.discard(wallpaper) self.thumbnail_loading.discard(wallpaper)
@@ -238,7 +241,7 @@ class WallpaperPlugin(PluginBase):
self.thumbnail_cache[filename] = pixbuf self.thumbnail_cache[filename] = pixbuf
return pixbuf return pixbuf
except Exception as e: except Exception as e:
print(f"Error loading thumbnail for {filename}: {e}") logger.error(f"Error loading thumbnail for {filename}: {e}")
self.thumbnail_cache[filename] = None self.thumbnail_cache[filename] = None
return None return None