From 82f62059f0b1e50b2fedeaac32c3b5dadeeec2d4 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 11 Jul 2019 20:17:38 +1000 Subject: [PATCH] Add more logging to help with debugging --- tuhigui/drawingperspective.py | 5 +++++ tuhigui/tuhi.py | 2 +- tuhigui/window.py | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tuhigui/drawingperspective.py b/tuhigui/drawingperspective.py index c34b01f..cf2085d 100644 --- a/tuhigui/drawingperspective.py +++ b/tuhigui/drawingperspective.py @@ -19,6 +19,10 @@ import json import gi gi.require_version("Gtk", "3.0") +import logging +logging.basicConfig(level=logging.DEBUG) +logger = logging.getLogger('drawingperspective') + @Gtk.Template(resource_path="/org/freedesktop/TuhiGui/ui/DrawingPerspective.ui") class DrawingPerspective(Gtk.Stack): @@ -70,6 +74,7 @@ class DrawingPerspective(Gtk.Stack): self._update_drawings(self.device, None) # We always want to sync on startup + logger.debug(f'{device.name} - starting to listen') device.start_listening() @GObject.Property diff --git a/tuhigui/tuhi.py b/tuhigui/tuhi.py index 767c84d..4833ac6 100644 --- a/tuhigui/tuhi.py +++ b/tuhigui/tuhi.py @@ -303,7 +303,7 @@ class TuhiKeteManager(_DBusObject): self._init() def _init(self, *args, **kwargs): - logger.info('online') + logger.info('manager is online') for objpath in self.property('Devices'): device = TuhiKeteDevice(self, objpath) self._devices[device.address] = device diff --git a/tuhigui/window.py b/tuhigui/window.py index da3b7b8..b936c60 100644 --- a/tuhigui/window.py +++ b/tuhigui/window.py @@ -18,9 +18,13 @@ from .drawingperspective import DrawingPerspective from .errorperspective import ErrorPerspective from .tuhi import TuhiKeteManager +import logging import gi gi.require_version("Gtk", "3.0") +logging.basicConfig(level=logging.DEBUG) +logger = logging.getLogger('window') + MENU_XML = """ @@ -62,6 +66,8 @@ class MainWindow(Gtk.ApplicationWindow): self._on_dbus_online() def _on_dbus_online(self, *args, **kwargs): + logger.debug('dbus is online') + dp = DrawingPerspective() self._add_perspective(dp) @@ -78,6 +84,7 @@ class MainWindow(Gtk.ApplicationWindow): self.stack_perspectives.set_visible_child_name(active.name) def _on_new_device_registered(self, setupperspective, device): + logger.debug('device was registered') setupperspective.disconnect_by_func(self._on_new_device_registered) self.headerbar.set_title(f'Tuhi - {device.name}')