# HG changeset patch # User Radek Brich # Date 1409554540 -7200 # Node ID 70c9cfc70cd6fb6e38c88a46f33e7b365a5a197d # Parent 742e504ec053986e91ca36819f92f8e4f586cd29 Update logging. diff -r 742e504ec053 -r 70c9cfc70cd6 .hgignore --- 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__ diff -r 742e504ec053 -r 70c9cfc70cd6 tuikit/core/widget.py --- 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 ## diff -r 742e504ec053 -r 70c9cfc70cd6 tuikit/core/window.py --- 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)