diff options
author | Agustin Zubiaga <aguz@sugarlabs.org> | 2012-09-05 16:50:32 (GMT) |
---|---|---|
committer | Agustin Zubiaga <aguz@sugarlabs.org> | 2012-09-05 16:50:32 (GMT) |
commit | 4325576b8e29370d1b8d2db86e8c02b125094865 (patch) | |
tree | bfc26f08514ae485c119935a7f026258a598401e | |
parent | e32b2d78d1c5fa87cf339378fb4858fd79f53fe0 (diff) |
Fix logging
-rw-r--r-- | activity.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/activity.py b/activity.py index 491e33e..403be25 100644 --- a/activity.py +++ b/activity.py @@ -32,6 +32,11 @@ from sugar3.graphics.toolbutton import ToolButton from gettext import gettext as _ +# _logger +_logger = logging.getLogger('chart-activity') +_logger.setLevel(logging.DEBUG) +logging.basicConfig() + import game SERVICE = 'org.sugarlabs.TicTacToe' @@ -136,7 +141,7 @@ class Activity(activity.Activity): def _new_tube_common(self, sharer): """Joining and sharing are mostly the same...""" if self.shared_activity is None: - logging.debug("Error: Failed to share or join activity ... \ + _logger.debug("Error: Failed to share or join activity ... \ _shared_activity is null in _shared_cb()") return @@ -151,11 +156,11 @@ class Activity(activity.Activity): 'NewTube', self._new_tube_cb) if sharer: - logging.debug('This is my activity: making a tube...') + _logger.debug('This is my activity: making a tube...') id = self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].OfferDBusTube( SERVICE, {}) else: - logging.debug('I am joining an activity: waiting for a tube...') + _logger.debug('I am joining an activity: waiting for a tube...') self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].ListTubes( reply_handler=self._list_tubes_reply_cb, error_handler=self._list_tubes_error_cb) @@ -167,11 +172,11 @@ class Activity(activity.Activity): def _list_tubes_error_cb(self, e): """Log errors.""" - logging.debug('Error: ListTubes() failed: %s' % (e)) + _logger.debug('Error: ListTubes() failed: %s' % (e)) def _new_tube_cb(self, id, initiator, type, service, params, state): """Create a new tube.""" - logging.debug('New tube: ID=%d initator=%d type=%d service=%s \ + _logger.debug('New tube: ID=%d initator=%d type=%d service=%s \ params=%r state=%d' % (id, initiator, type, service, params, state)) if (type == telepathy.TUBE_TYPE_DBUS and service == SERVICE): @@ -200,7 +205,7 @@ params=%r state=%d' % (id, initiator, type, service, params, state)) try: command, payload = event_message.split('|', 2) except ValueError: - logging.debug('Could not split event message %s' % (event_message)) + _logger.debug('Could not split event message %s' % (event_message)) return self._processing_methods[command][0](payload) @@ -212,11 +217,11 @@ params=%r state=%d' % (id, initiator, type, service, params, state)) def _receive_new_cross(self, square): square = int(square) - logging.debug('Receive a new cross %s' % square) + _logger.debug('Receive a new cross %s' % square) def _receive_new_circle(self, square): square = int(square) - logging.debug('Receive a new circle %s' % square) + _logger.debug('Receive a new circle %s' % square) def send_event(self, entry): """ Send event through the tube. """ |