Commit 82707818 authored by Antoine Millet's avatar Antoine Millet

Fixed logging calls with format string.

parent 8d93a63f
......@@ -84,7 +84,7 @@ class SimpleRpcClient(ConnectionManager):
self._connection.receive()
except socket.error as err:
logging.error('Socket error while receiving from the client '
'fd/%s: %s' % (fd, err))
'fd/%s: %s', fd, err)
self.shutdown()
if event & select.EPOLLOUT:
......@@ -93,11 +93,11 @@ class SimpleRpcClient(ConnectionManager):
self._connection.send()
except socket.error as err:
logging.error('Socket error while sending to the client '
'fd/%s: %s' % (fd, err))
'fd/%s: %s', fd, err)
self.shutdown()
if event & select.EPOLLHUP:
logging.error('Socket HUP fd/%s' % fd)
logging.error('Socket HUP fd/%s', fd)
self.shutdown() #TODO
def all_connections(self):
......
......@@ -149,7 +149,7 @@ class RpcConnection(object):
payload = self._inbound_buffer.pull(self._cur_msg_size)
self._cur_msg_size = None
message = json.loads(payload)
logging.debug('Received: %s' % message)
logging.debug('Received: %s', message)
self.dispatch(message)
return True
......@@ -164,7 +164,7 @@ class RpcConnection(object):
Message must be a jsonisable structure.
'''
logging.debug('Sending: %s' % message)
logging.debug('Sending: %s', message)
json_msg = json.dumps(message)
size = struct.pack('!L', len(json_msg))
with self._outbound_buffer:
......@@ -224,7 +224,7 @@ class RpcConnection(object):
self._send_response(msg_id, returned=returned)
def error(self, msg_id, error, message):
def error(self, msg_id, error, message, traceback=None):
'''
Send an error response to the peer.
......@@ -363,7 +363,7 @@ class RpcConnection(object):
# manager while cleanup.
else:
logging.warning('Malformed message received: %s' % message)
logging.warning('Malformed message received: %s', message)
def shutdown(self, callback=None):
'''
......@@ -401,7 +401,7 @@ class RpcConnection(object):
callback(self)
except Exception as err:
logging.error('Error while execution of shutdown '
'callback: %s' % err)
'callback: %s', err)
def clean_call(self, msg_id):
'''
......
......@@ -79,11 +79,11 @@ class SimpleRpcServer(ConnectionManager):
connection.receive()
except socket.error as err:
logging.error('Socket error while receiving from client '
'fd/%s: %s' % (fd, err))
'fd/%s: %s', fd, err)
self.shutdown_client(fd)
except Exception as err:
logging.error('Unknown error while receiving from client '
'fd/%s: %s' % (fd, err))
'fd/%s: %s', fd, err)
self.shutdown_client(fd)
if event & select.EPOLLOUT:
......@@ -92,15 +92,15 @@ class SimpleRpcServer(ConnectionManager):
connection.send()
except socket.error as err:
logging.error('Socket error while sending to the client '
'fd/%s: %s' % (fd, err))
'fd/%s: %s', fd, err)
self.shutdown_client(fd)
except Exception as err:
logging.error('Unknown error while sending to the client '
'fd/%s: %s' % (fd, err))
'fd/%s: %s', fd, err)
self.shutdown_client(fd)
if event & select.EPOLLHUP:
logging.error('Socket HUP fd/%s' % fd)
logging.error('Socket HUP fd/%s', fd)
self.shutdown_client(fd)
......@@ -129,6 +129,6 @@ class SimpleSslRpcServer(SimpleRpcServer):
ssl_version=ssl.PROTOCOL_TLSv1,
do_handshake_on_connect=True)
except ssl.SSLError as err:
logging.error('Error when accepting ssl connection: %s' % err)
logging.error('Error when accepting ssl connection: %s', err)
else:
return sslsock, address
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment