let the logger do the formatting
This commit is contained in:
parent
bdd760d92a
commit
496090fe62
@ -305,8 +305,8 @@ class Activity(Window, gtk.Container):
|
||||
else:
|
||||
self.__joined_cb(self.shared_activity, True, None)
|
||||
elif share_scope != SCOPE_PRIVATE:
|
||||
logging.debug("*** Act %s no existing mesh instance, but used to " \
|
||||
"be shared, will share" % self._activity_id)
|
||||
logging.debug('*** Act %s no existing mesh instance, but used to '
|
||||
'be shared, will share', self._activity_id)
|
||||
# no existing mesh instance, but activity used to be shared, so
|
||||
# restart the share
|
||||
if share_scope == SCOPE_INVITE_ONLY:
|
||||
@ -314,7 +314,7 @@ class Activity(Window, gtk.Container):
|
||||
elif share_scope == SCOPE_NEIGHBORHOOD:
|
||||
self.share(private=False)
|
||||
else:
|
||||
logging.debug("Unknown share scope %r" % share_scope)
|
||||
logging.debug('Unknown share scope %r', share_scope)
|
||||
|
||||
if handle.object_id is None and create_jobject:
|
||||
logging.debug('Creating a jobject.')
|
||||
@ -409,7 +409,7 @@ class Activity(Window, gtk.Container):
|
||||
pass
|
||||
|
||||
def __jobject_error_cb(self, err):
|
||||
logging.debug("Error creating activity datastore object: %s" % err)
|
||||
logging.debug('Error creating activity datastore object: %s', err)
|
||||
|
||||
def get_activity_root(self):
|
||||
""" FIXME: Deprecated. This part of the API has been moved
|
||||
@ -486,12 +486,12 @@ class Activity(Window, gtk.Container):
|
||||
if self._closing:
|
||||
self._show_keep_failed_dialog()
|
||||
self._closing = False
|
||||
logging.debug("Error saving activity object to datastore: %s" % err)
|
||||
logging.debug('Error saving activity object to datastore: %s', err)
|
||||
|
||||
def _cleanup_jobject(self):
|
||||
if self._jobject:
|
||||
if self._owns_file and os.path.isfile(self._jobject.file_path):
|
||||
logging.debug('_cleanup_jobject: removing %r' %
|
||||
logging.debug('_cleanup_jobject: removing %r',
|
||||
self._jobject.file_path)
|
||||
os.remove(self._jobject.file_path)
|
||||
self._owns_file = False
|
||||
@ -550,7 +550,7 @@ class Activity(Window, gtk.Container):
|
||||
logging.debug('Cannot save, no journal object.')
|
||||
return
|
||||
|
||||
logging.debug('Activity.save: %r' % self._jobject.object_id)
|
||||
logging.debug('Activity.save: %r', self._jobject.object_id)
|
||||
|
||||
if self._updating_jobject:
|
||||
logging.info('Activity.save: still processing a previous request.')
|
||||
@ -594,7 +594,7 @@ class Activity(Window, gtk.Container):
|
||||
Activities should not override this method. Instead, like save() do any
|
||||
copy work that needs to be done in write_file()
|
||||
"""
|
||||
logging.debug('Activity.copy: %r' % self._jobject.object_id)
|
||||
logging.debug('Activity.copy: %r', self._jobject.object_id)
|
||||
self.save()
|
||||
self._jobject.object_id = None
|
||||
|
||||
@ -609,7 +609,7 @@ class Activity(Window, gtk.Container):
|
||||
self.shared_activity.disconnect(self._join_id)
|
||||
self._join_id = None
|
||||
if not success:
|
||||
logging.debug("Failed to join activity: %s" % err)
|
||||
logging.debug('Failed to join activity: %s', err)
|
||||
return
|
||||
|
||||
self.present()
|
||||
@ -633,8 +633,8 @@ class Activity(Window, gtk.Container):
|
||||
self._pservice.disconnect(self._share_id)
|
||||
self._share_id = None
|
||||
if not success:
|
||||
logging.debug('Share of activity %s failed: %s.' %
|
||||
(self._activity_id, err))
|
||||
logging.debug('Share of activity %s failed: %s.',
|
||||
self._activity_id, err)
|
||||
return
|
||||
|
||||
logging.debug('Share of activity %s successful, PS activity is %r.',
|
||||
@ -652,7 +652,7 @@ class Activity(Window, gtk.Container):
|
||||
|
||||
def _invite_response_cb(self, error):
|
||||
if error:
|
||||
logging.error('Invite failed: %s' % error)
|
||||
logging.error('Invite failed: %s', error)
|
||||
|
||||
def _send_invites(self):
|
||||
while self._invites_queue:
|
||||
@ -662,7 +662,7 @@ class Activity(Window, gtk.Container):
|
||||
self.shared_activity.invite(
|
||||
buddy, '', self._invite_response_cb)
|
||||
else:
|
||||
logging.error('Cannot invite %s, no such buddy.' % buddy_key)
|
||||
logging.error('Cannot invite %s, no such buddy.', buddy_key)
|
||||
|
||||
def invite(self, buddy_key):
|
||||
"""Invite a buddy to join this Activity.
|
||||
@ -692,8 +692,8 @@ class Activity(Window, gtk.Container):
|
||||
raise RuntimeError("Activity %s already shared." %
|
||||
self._activity_id)
|
||||
verb = private and 'private' or 'public'
|
||||
logging.debug('Requesting %s share of activity %s.' %
|
||||
(verb, self._activity_id))
|
||||
logging.debug('Requesting %s share of activity %s.', verb,
|
||||
self._activity_id)
|
||||
self._share_id = self._pservice.connect("activity-shared",
|
||||
self.__share_cb)
|
||||
self._pservice.share_activity(self, private=private)
|
||||
|
@ -143,7 +143,7 @@ def get_command(activity, activity_id=None, object_id=None, uri=None):
|
||||
if os.path.exists(absolute_path):
|
||||
command[0] = absolute_path
|
||||
|
||||
logging.debug('launching: %r' % command)
|
||||
logging.debug('launching: %r', command)
|
||||
|
||||
return command
|
||||
|
||||
@ -300,25 +300,25 @@ class ActivityCreationHandler(gobject.GObject):
|
||||
pass
|
||||
|
||||
def _notify_launch_failure_error_handler(self, err):
|
||||
logging.error('Notify launch failure failed %s' % err)
|
||||
logging.error('Notify launch failure failed %s', err)
|
||||
|
||||
def _notify_launch_error_handler(self, err):
|
||||
logging.debug('Notify launch failed %s' % err)
|
||||
logging.debug('Notify launch failed %s', err)
|
||||
|
||||
def _activate_reply_handler(self, activated):
|
||||
if not activated:
|
||||
self._create_activity()
|
||||
|
||||
def _activate_error_handler(self, err):
|
||||
logging.error("Activity activation request failed %s" % err)
|
||||
logging.error('Activity activation request failed %s', err)
|
||||
|
||||
def _create_reply_handler(self):
|
||||
logging.debug("Activity created %s (%s)." %
|
||||
(self._handle.activity_id, self._service_name))
|
||||
logging.debug('Activity created %s (%s).',
|
||||
self._handle.activity_id, self._service_name)
|
||||
|
||||
def _create_error_handler(self, err):
|
||||
logging.error("Couldn't create activity %s (%s): %s" %
|
||||
(self._handle.activity_id, self._service_name, err))
|
||||
logging.error("Couldn't create activity %s (%s): %s",
|
||||
self._handle.activity_id, self._service_name, err)
|
||||
self._shell.NotifyLaunchFailure(
|
||||
self._handle.activity_id, reply_handler=self._no_reply_handler,
|
||||
error_handler=self._notify_launch_failure_error_handler)
|
||||
@ -331,7 +331,7 @@ class ActivityCreationHandler(gobject.GObject):
|
||||
self._launch_activity()
|
||||
|
||||
def _find_object_error_handler(self, err):
|
||||
logging.error("Datastore find failed %s" % err)
|
||||
logging.error('Datastore find failed %s', err)
|
||||
self._launch_activity()
|
||||
|
||||
def create(bundle, activity_handle=None):
|
||||
|
@ -61,7 +61,7 @@ class ActivityService(dbus.service.Object):
|
||||
|
||||
@dbus.service.method(_ACTIVITY_INTERFACE)
|
||||
def SetActive(self, active):
|
||||
logging.debug('ActivityService.set_active: %s.' % active)
|
||||
logging.debug('ActivityService.set_active: %s.', active)
|
||||
self._activity.props.active = active
|
||||
|
||||
@dbus.service.method(_ACTIVITY_INTERFACE)
|
||||
|
@ -110,21 +110,21 @@ class ActivityBundle(Bundle):
|
||||
# Remove duplicates
|
||||
if line in lines[0:num]:
|
||||
lines[num] = ""
|
||||
logging.warning("Bundle %s: duplicate entry in MANIFEST: %s"
|
||||
% (self._name,line))
|
||||
logging.warning('Bundle %s: duplicate entry in MANIFEST: %s',
|
||||
self._name, line)
|
||||
continue
|
||||
|
||||
# Remove MANIFEST
|
||||
if line == "MANIFEST":
|
||||
lines[num] = ""
|
||||
logging.warning("Bundle %s: MANIFEST includes itself: %s"
|
||||
% (self._name,line))
|
||||
logging.warning('Bundle %s: MANIFEST includes itself: %s',
|
||||
self._name, line)
|
||||
|
||||
# Remove invalid files
|
||||
if not self.is_file(line):
|
||||
lines[num] = ""
|
||||
logging.warning("Bundle %s: invalid entry in MANIFEST: %s"
|
||||
% (self._name,line))
|
||||
logging.warning('Bundle %s: invalid entry in MANIFEST: %s',
|
||||
self._name, line)
|
||||
|
||||
return lines
|
||||
|
||||
@ -311,8 +311,8 @@ class ActivityBundle(Bundle):
|
||||
if path in manifestfiles:
|
||||
manifestfiles.remove(path)
|
||||
elif path != "MANIFEST":
|
||||
logging.warning("Bundle %s: %s not in MANIFEST"%
|
||||
(self._name,path))
|
||||
logging.warning('Bundle %s: %s not in MANIFEST', self._name,
|
||||
path)
|
||||
if strict_manifest:
|
||||
os.remove(os.path.join(install_path, path))
|
||||
|
||||
|
@ -121,7 +121,7 @@ class Bundle(object):
|
||||
data = self._zip_file.read(path)
|
||||
f = StringIO.StringIO(data)
|
||||
except KeyError:
|
||||
logging.debug('%s not found.' % filename)
|
||||
logging.debug('%s not found.', filename)
|
||||
|
||||
return f
|
||||
|
||||
|
@ -183,7 +183,7 @@ def write(ds_object, update_mtime=True, transfer_ownership=False,
|
||||
transfer_ownership)
|
||||
ds_object.metadata['uid'] = ds_object.object_id
|
||||
# TODO: register the object for updates
|
||||
logging.debug('Written object %s to the datastore.' % ds_object.object_id)
|
||||
logging.debug('Written object %s to the datastore.', ds_object.object_id)
|
||||
|
||||
def delete(object_id):
|
||||
logging.debug('datastore.delete')
|
||||
|
@ -52,8 +52,8 @@ def update(uid, properties, filename, transfer_ownership=False,
|
||||
debug_props = properties.copy()
|
||||
if debug_props.has_key("preview"):
|
||||
debug_props["preview"] = "<omitted>"
|
||||
logging.debug('dbus_helpers.update: %s, %s, %s, %s' %
|
||||
(uid, filename, debug_props, transfer_ownership))
|
||||
logging.debug('dbus_helpers.update: %s, %s, %s, %s', uid, filename,
|
||||
debug_props, transfer_ownership)
|
||||
if reply_handler and error_handler:
|
||||
_get_data_store().update(uid, dbus.Dictionary(properties), filename,
|
||||
transfer_ownership,
|
||||
@ -65,20 +65,20 @@ def update(uid, properties, filename, transfer_ownership=False,
|
||||
filename, transfer_ownership)
|
||||
|
||||
def delete(uid):
|
||||
logging.debug('dbus_helpers.delete: %r' % uid)
|
||||
logging.debug('dbus_helpers.delete: %r', uid)
|
||||
_get_data_store().delete(uid)
|
||||
|
||||
def get_properties(uid):
|
||||
logging.debug('dbus_helpers.get_properties: %s' % uid)
|
||||
logging.debug('dbus_helpers.get_properties: %s', uid)
|
||||
return _get_data_store().get_properties(uid, byte_arrays=True)
|
||||
|
||||
def get_filename(uid):
|
||||
filename = _get_data_store().get_filename(uid)
|
||||
logging.debug('dbus_helpers.get_filename: %s, %s' % (uid, filename))
|
||||
logging.debug('dbus_helpers.get_filename: %s, %s', uid, filename)
|
||||
return filename
|
||||
|
||||
def find(query, properties, reply_handler, error_handler):
|
||||
logging.debug('dbus_helpers.find: %r %r' % (query, properties))
|
||||
logging.debug('dbus_helpers.find: %r %r', query, properties)
|
||||
if reply_handler and error_handler:
|
||||
return _get_data_store().find(query, properties,
|
||||
reply_handler=reply_handler, error_handler=error_handler,
|
||||
|
@ -143,8 +143,8 @@ class _IconBuffer(object):
|
||||
|
||||
del info
|
||||
else:
|
||||
logging.warning('No icon with the name %s '
|
||||
'was found in the theme.' % self.icon_name)
|
||||
logging.warning('No icon with the name %s was found in the '
|
||||
'theme.', self.icon_name)
|
||||
|
||||
return icon_info
|
||||
|
||||
|
@ -110,7 +110,7 @@ class ObjectChooser(object):
|
||||
def __chooser_response_cb(self, chooser_id, object_id):
|
||||
if chooser_id != self._chooser_id:
|
||||
return
|
||||
logging.debug('ObjectChooser.__chooser_response_cb: %r' % object_id)
|
||||
logging.debug('ObjectChooser.__chooser_response_cb: %r', object_id)
|
||||
self._response_code = gtk.RESPONSE_ACCEPT
|
||||
self._object_id = object_id
|
||||
self._cleanup()
|
||||
@ -118,7 +118,7 @@ class ObjectChooser(object):
|
||||
def __chooser_cancelled_cb(self, chooser_id):
|
||||
if chooser_id != self._chooser_id:
|
||||
return
|
||||
logging.debug('ObjectChooser.__chooser_cancelled_cb: %r' % chooser_id)
|
||||
logging.debug('ObjectChooser.__chooser_cancelled_cb: %r', chooser_id)
|
||||
self._response_code = gtk.RESPONSE_CANCEL
|
||||
self._cleanup()
|
||||
|
||||
|
@ -179,7 +179,7 @@ class Palette(PaletteWindow):
|
||||
return self._full_request
|
||||
|
||||
def popup(self, immediate=False, state=None):
|
||||
logging.debug('Palette.popup immediate %r' % immediate)
|
||||
logging.debug('Palette.popup immediate %r', immediate)
|
||||
|
||||
if self._invoker is not None:
|
||||
self._update_full_request()
|
||||
|
@ -325,7 +325,7 @@ class PaletteWindow(gtk.Window):
|
||||
self.show()
|
||||
|
||||
def popdown(self, immediate=False):
|
||||
logging.debug('PaletteWindow.popdown immediate %r' % immediate)
|
||||
logging.debug('PaletteWindow.popdown immediate %r', immediate)
|
||||
self._popup_anim.stop()
|
||||
|
||||
self._mouse_detector.stop()
|
||||
|
@ -205,7 +205,7 @@ class _ToolbarPalette(PaletteWindow):
|
||||
def _handle_focus(self, delta):
|
||||
self._focus += delta
|
||||
if self._focus not in (0, 1):
|
||||
logging.error('_Palette._focus=%s not in (0, 1)' % self._focus)
|
||||
logging.error('_Palette._focus=%s not in (0, 1)', self._focus)
|
||||
|
||||
if self._focus == 0:
|
||||
group = palettegroup.get_group('default')
|
||||
|
@ -473,8 +473,8 @@ class PresenceService(gobject.GObject):
|
||||
|
||||
def _share_activity_error_cb(self, activity, err):
|
||||
"""Notify with GObject event of unsuccessful sharing of activity"""
|
||||
_logger.debug("Error sharing activity %s: %s" %
|
||||
(activity.get_id(), err))
|
||||
_logger.debug('Error sharing activity %s: %s', activity.get_id(),
|
||||
err)
|
||||
self.emit("activity-shared", False, None, err)
|
||||
|
||||
def share_activity(self, activity, properties=None, private=True):
|
||||
|
@ -66,8 +66,8 @@ class Profile(object):
|
||||
f = open(key_path, "r")
|
||||
lines = f.readlines()
|
||||
f.close()
|
||||
except IOError, e:
|
||||
logging.error("Error reading public key: %s" % e)
|
||||
except IOError:
|
||||
logging.exception('Error reading public key')
|
||||
return None
|
||||
|
||||
magic = "ssh-dss "
|
||||
@ -92,8 +92,8 @@ class Profile(object):
|
||||
f = open(key_path, "r")
|
||||
lines = f.readlines()
|
||||
f.close()
|
||||
except IOError, e:
|
||||
logging.error("Error reading private key: %s" % e)
|
||||
except IOError:
|
||||
logging.exception('Error reading private key')
|
||||
return None
|
||||
|
||||
key = ""
|
||||
|
@ -272,7 +272,7 @@ class TempFilePath(str):
|
||||
if path is None:
|
||||
fd, path = tempfile.mkstemp()
|
||||
os.close(fd)
|
||||
logging.debug('TempFilePath created %r' % path)
|
||||
logging.debug('TempFilePath created %r', path)
|
||||
|
||||
if path in _tracked_paths:
|
||||
_tracked_paths[path] += 1
|
||||
@ -287,9 +287,9 @@ class TempFilePath(str):
|
||||
|
||||
if os.path.exists(self):
|
||||
os.unlink(self)
|
||||
logging.debug('TempFilePath deleted %r' % self)
|
||||
logging.debug('TempFilePath deleted %r', self)
|
||||
else:
|
||||
logging.warning('TempFilePath already deleted %r' % self)
|
||||
logging.warning('TempFilePath already deleted %r', self)
|
||||
else:
|
||||
_tracked_paths[self] -= 1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user