Use logging's built-in string interpolation

This commit is contained in:
Jeff Widman
2017-07-07 11:32:25 -07:00
parent 43939b29b5
commit 2f75169504
2 changed files with 5 additions and 6 deletions

View File

@@ -247,12 +247,12 @@ class BrokerConnection(object):
socket.AF_UNSPEC,
socket.SOCK_STREAM)
except socket.gaierror as ex:
log.warning('DNS lookup failed for {0}:{1},'
' exception was {2}. Is your'
log.warning('DNS lookup failed for %s:%d,'
' exception was %s. Is your'
' advertised.listeners (called'
' advertised.host.name before Kafka 9)'
' correct and resolvable?'.format(
self._init_host, self._init_port, ex))
' correct and resolvable?',
self._init_host, self._init_port, ex)
self._gai = []
self._gai_index = 0
else:

View File

@@ -217,8 +217,7 @@ def _send_upstream(queue, client, codec, batch_time, batch_size,
else hash(orig_req.messages))
if request_tries or not queue.empty():
log.error('Stopped producer with {0} unsent messages'
.format(len(request_tries) + queue.qsize()))
log.error('Stopped producer with %d unsent messages', len(request_tries) + queue.qsize())
class Producer(object):