From 761d752363c451a82153d8fea13713028106ef99 Mon Sep 17 00:00:00 2001 From: Rusty Bird Date: Fri, 5 Feb 2021 18:39:16 +0000 Subject: [PATCH] log: remove unused DBusHandler --- qubes/log.py | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/qubes/log.py b/qubes/log.py index b0a4e37e..6d0866e1 100644 --- a/qubes/log.py +++ b/qubes/log.py @@ -29,8 +29,6 @@ import os import sys import fcntl -import dbus - FORMAT_CONSOLE = '%(message)s' FORMAT_LOG = '%(asctime)s %(message)s' FORMAT_DEBUG = '%(asctime)s ' \ @@ -41,42 +39,6 @@ formatter_console = logging.Formatter(FORMAT_CONSOLE) formatter_log = logging.Formatter(FORMAT_LOG) formatter_debug = logging.Formatter(FORMAT_DEBUG) -class DBusHandler(logging.Handler): - '''Handler which displays records as DBus notifications''' - - #: mapping of loglevels to icons - app_icons = { - logging.ERROR: 'dialog-error', - logging.WARNING: 'dialog-warning', - logging.NOTSET: 'dialog-information', - } - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - self._notify_object = dbus.SessionBus().get_object( - 'org.freedesktop.Notifications', '/org/freedesktop/Notifications') - - - def emit(self, record): - app_icon = self.app_icons[ - max(level for level in self.app_icons if level <= record.levelno)] - - try: - # https://developer.gnome.org/notification-spec/#command-notify - self._notify_object.Notify( - 'Qubes', # STRING app_name - 0, # UINT32 replaces_id - app_icon, # STRING app_icon - record.msg, # STRING summary - '', # STRING body - (), # ARRAY actions - {}, # DICT hints - 0, # INT32 timeout - dbus_interface='org.freedesktop.Notifications') - except dbus.DBusException: - pass - def enable(): '''Enable global logging