[gnome-music/wip/mschraal/glib-logging: 24/65] trackerwrapper: New logger
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/glib-logging: 24/65] trackerwrapper: New logger
- Date: Sat, 1 Feb 2020 15:18:27 +0000 (UTC)
commit 7210afe39ffeb129f5d02571e1c7b94dede39bce
Author: Marinus Schraal <mschraal gnome org>
Date: Sat Feb 1 14:37:58 2020 +0100
trackerwrapper: New logger
gnomemusic/trackerwrapper.py | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/gnomemusic/trackerwrapper.py b/gnomemusic/trackerwrapper.py
index 06e406e9..0995dd4d 100644
--- a/gnomemusic/trackerwrapper.py
+++ b/gnomemusic/trackerwrapper.py
@@ -22,12 +22,10 @@
# delete this exception statement from your version.
from enum import IntEnum
-import logging
from gi.repository import GLib, GObject, Tracker
-logger = logging.getLogger(__name__)
-
+from gnomemusic.musiclogger import MusicLogger
class TrackerState(IntEnum):
"""Tracker Status
@@ -40,12 +38,11 @@ class TrackerState(IntEnum):
class TrackerWrapper(GObject.GObject):
"""Create a connection to an instance of Tracker"""
- def __repr__(self):
- return "<TrackerWrapper>"
-
def __init__(self):
super().__init__()
+ self._log = MusicLogger()
+
self._tracker = None
self._tracker_available = TrackerState.UNAVAILABLE
@@ -55,7 +52,8 @@ class TrackerWrapper(GObject.GObject):
try:
self._tracker = Tracker.SparqlConnection.get_finish(result)
except GLib.Error as error:
- logger.warning("Error: {}, {}".format(error.domain, error.message))
+ self._log.warning(
+ "Error: {}, {}".format(error.domain, error.message))
self.notify("tracker-available")
return
@@ -69,7 +67,8 @@ class TrackerWrapper(GObject.GObject):
klass.query_finish(result)
self._tracker_available = TrackerState.AVAILABLE
except GLib.Error as error:
- logger.warning("Error: {}, {}".format(error.domain, error.message))
+ self._log.warning(
+ "Error: {}, {}".format(error.domain, error.message))
self._tracker_available = TrackerState.OUTDATED
self.notify("tracker-available")
@@ -99,7 +98,7 @@ class TrackerWrapper(GObject.GObject):
GLib.UserDirectory.DIRECTORY_MUSIC)
assert music_dir is not None
except (TypeError, AssertionError):
- logger.warning("XDG Music dir is not set")
+ self._log.message("XDG Music dir is not set")
return None
music_dir = Tracker.sparql_escape_string(
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]