Update logging.
--- a/.hgignore Mon Sep 01 08:45:51 2014 +0200
+++ b/.hgignore Mon Sep 01 08:55:40 2014 +0200
@@ -12,5 +12,6 @@
^(.*/)?\.pydevproject$
^\.settings
^\.idea/
+^\.ackrc$
.*\.appstats
__pycache__
--- a/tuikit/core/widget.py Mon Sep 01 08:45:51 2014 +0200
+++ b/tuikit/core/widget.py Mon Sep 01 08:55:40 2014 +0200
@@ -12,12 +12,9 @@
def __init__(self):
self._num_instances += 1
- self._log = logging.getLogger(__name__)
#: Widget name is used for logging etc. Not visible anywhere.
- self.name = '{}{}'.format(
- self.__class__.__name__,
- self._num_instances)
+ self.name = '%s#%s' % (self.__class__.__name__, self._num_instances)
#: Parent Widget
self.parent = None
@@ -45,6 +42,9 @@
#: Position outside of widget boundaries means no cursor (hidden).
self._cursor = Point(-1, -1)
+ #: Logger name contains full module name, class name and instance number
+ self._log = logging.getLogger('%s.%s' % (self.__module__, self.name))
+
## position and size ##
@property
@@ -74,8 +74,8 @@
def draw(self, buffer):
"""Draw self into buffer."""
- self._log.debug('%s draw into %r at %s (exposed %s)',
- self.name, buffer, buffer.origin, self.exposed(buffer))
+ self._log.debug('draw into %r at %s (exposed %s)',
+ buffer, buffer.origin, self.exposed(buffer))
def set_theme(self, theme):
self.theme = theme
@@ -102,8 +102,8 @@
## input events ##
def keypress(self, keyname, char, mod):
- self._log.debug('%s keypress(%r, %r, %r)',
- self.name, keyname, char, mod)
+ self._log.debug('keypress(keyname=%r, char=%r, mod=%r)',
+ keyname, char, mod)
## timeouts ##
--- a/tuikit/core/window.py Mon Sep 01 08:45:51 2014 +0200
+++ b/tuikit/core/window.py Mon Sep 01 08:55:40 2014 +0200
@@ -62,6 +62,7 @@
def handle_event(self, event_name, *args):
"""Handle input event to managed windows."""
+ self._log.debug('Handle event: %s %r', event_name, args)
handler = getattr(self, event_name, None)
if handler:
handler(*args)