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.AF_UNSPEC,
socket.SOCK_STREAM) socket.SOCK_STREAM)
except socket.gaierror as ex: except socket.gaierror as ex:
log.warning('DNS lookup failed for {0}:{1},' log.warning('DNS lookup failed for %s:%d,'
' exception was {2}. Is your' ' exception was %s. Is your'
' advertised.listeners (called' ' advertised.listeners (called'
' advertised.host.name before Kafka 9)' ' advertised.host.name before Kafka 9)'
' correct and resolvable?'.format( ' correct and resolvable?',
self._init_host, self._init_port, ex)) self._init_host, self._init_port, ex)
self._gai = [] self._gai = []
self._gai_index = 0 self._gai_index = 0
else: else:

View File

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