Make log information format

Change-Id: I4a7699ce17c136490327776c0a3c3be450526814
This commit is contained in:
zheng yin 2016-08-04 13:05:32 +08:00
parent d819ae00a5
commit ce44ec45a4
2 changed files with 7 additions and 6 deletions

View File

@ -140,7 +140,7 @@ class AccountAuditor(Daemon):
self.validate_per_policy_counts(broker) self.validate_per_policy_counts(broker)
self.logger.increment('passes') self.logger.increment('passes')
self.account_passes += 1 self.account_passes += 1
self.logger.debug('Audit passed for %s' % broker) self.logger.debug(_('Audit passed for %s'), broker)
except InvalidAccountInfo as e: except InvalidAccountInfo as e:
self.logger.increment('failures') self.logger.increment('failures')
self.account_failures += 1 self.account_failures += 1

View File

@ -1420,8 +1420,8 @@ class StatsdClient(object):
except IOError as err: except IOError as err:
if self.logger: if self.logger:
self.logger.warning( self.logger.warning(
'Error sending UDP message to %r: %s', _('Error sending UDP message to %(target)r: %(err)s'),
self._target, err) {'target': self._target, 'err': err})
def _open_socket(self): def _open_socket(self):
return socket.socket(self._sock_family, socket.SOCK_DGRAM) return socket.socket(self._sock_family, socket.SOCK_DGRAM)
@ -2453,7 +2453,8 @@ def audit_location_generator(devices, datadir, suffix='',
partitions = listdir(datadir_path) partitions = listdir(datadir_path)
except OSError as e: except OSError as e:
if logger: if logger:
logger.warning('Skipping %s because %s', datadir_path, e) logger.warning(_('Skipping %(datadir)s because %(err)s'),
{'datadir': datadir_path, 'err': e})
continue continue
for partition in partitions: for partition in partitions:
part_path = os.path.join(datadir_path, partition) part_path = os.path.join(datadir_path, partition)
@ -3460,7 +3461,7 @@ def override_bytes_from_content_type(listing_dict, logger=None):
listing_dict['bytes'] = int(swift_bytes) listing_dict['bytes'] = int(swift_bytes)
except ValueError: except ValueError:
if logger: if logger:
logger.exception("Invalid swift_bytes") logger.exception(_("Invalid swift_bytes"))
def clean_content_type(value): def clean_content_type(value):
@ -3766,7 +3767,7 @@ def document_iters_to_http_response_body(ranges_iter, boundary, multipart,
pass pass
else: else:
logger.warning( logger.warning(
"More than one part in a single-part response?") _("More than one part in a single-part response?"))
return string_along(response_body_iter, ranges_iter, logger) return string_along(response_body_iter, ranges_iter, logger)