Commit 74ebf6f2 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Packet logging improved thanks to Enum class.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@428 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 4dd996c2
...@@ -284,6 +284,9 @@ class Connection(BaseConnection): ...@@ -284,6 +284,9 @@ class Connection(BaseConnection):
if self.connector is None: if self.connector is None:
return return
ip, port = self.getAddress()
logging.debug('#0x%04x %s to %s:%d', packet.getId(),
packet.getType(), *self.getAddress())
try: try:
self.write_buf.append(packet.encode()) self.write_buf.append(packet.encode())
except ProtocolError, m: except ProtocolError, m:
......
...@@ -75,8 +75,8 @@ class EventHandler(object): ...@@ -75,8 +75,8 @@ class EventHandler(object):
def packetReceived(self, conn, packet): def packetReceived(self, conn, packet):
"""Called when a packet is received.""" """Called when a packet is received."""
logging.debug('packet %d:%x received from %s:%d', logging.debug('#0x%04x %s from %s:%d',
packet.getId(), packet.getType(), *(conn.getAddress())) packet.getId(), packet.getType(), *conn.getAddress())
self.dispatch(conn, packet) self.dispatch(conn, packet)
def packetMalformed(self, conn, packet, error_message): def packetMalformed(self, conn, packet, error_message):
......
This diff is collapsed.
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