better debug logging
This commit is contained in:
parent
ca18387cff
commit
23a22e3adf
2 changed files with 5 additions and 6 deletions
|
@ -268,7 +268,7 @@ class MinecraftClient(CallbacksHolder, Runnable):
|
|||
self.dispatcher.state = ConnectionState.PLAY
|
||||
self.run_callbacks(ClientEvent.CONNECTED)
|
||||
async for packet in self.dispatcher.packets():
|
||||
self._logger.debug("[ * ] Processing | %s", str(packet))
|
||||
self._logger.debug("[ * ] Processing %s", packet.__class__.__name__)
|
||||
if isinstance(packet, PacketSetCompression):
|
||||
self._logger.info("Compression updated")
|
||||
self.dispatcher.compression = packet.threshold
|
||||
|
|
|
@ -199,7 +199,6 @@ class Dispatcher:
|
|||
async def _down_worker(self, timeout:float=30):
|
||||
while self._dispatching:
|
||||
try: # these 2 will timeout or raise EOFError if client gets disconnected
|
||||
self._logger.debug("Reading packet")
|
||||
data = await asyncio.wait_for(self._read_packet(), timeout=timeout)
|
||||
|
||||
if self.encryption:
|
||||
|
@ -220,9 +219,8 @@ class Dispatcher:
|
|||
if packet_id in BROKEN_PACKETS:
|
||||
continue # cheap fix, still need to implement NBT, Slot and EntityMetadata...
|
||||
cls = self._packet_type_from_registry(packet_id)
|
||||
self._logger.debug("Deserializing packet %s | %s", str(cls), cls._state)
|
||||
packet = cls.deserialize(self.proto, buffer)
|
||||
self._logger.debug("[<--] Received | %s", str(packet))
|
||||
self._logger.debug("[<--] Received | %s", repr(packet))
|
||||
await self._incoming.put(packet)
|
||||
if self.state != ConnectionState.PLAY:
|
||||
await self._incoming.join() # During play we can pre-process packets
|
||||
|
@ -236,7 +234,8 @@ class Dispatcher:
|
|||
self._logger.error("Received EOF while reading packet")
|
||||
await self.disconnect(block=False)
|
||||
except Exception:
|
||||
self._logger.exception("Exception parsing packet %d | %s", packet_id, buffer.getvalue())
|
||||
self._logger.exception("Exception parsing packet %d", packet_id)
|
||||
self._logger.debug("%s", buffer.getvalue())
|
||||
await self.disconnect(block=False)
|
||||
|
||||
async def _up_worker(self, timeout=1):
|
||||
|
@ -270,7 +269,7 @@ class Dispatcher:
|
|||
self._up.write(data)
|
||||
await self._up.drain()
|
||||
|
||||
self._logger.debug("[-->] Sent | %s", str(packet))
|
||||
self._logger.debug("[-->] Sent | %s", repr(packet))
|
||||
except Exception:
|
||||
self._logger.exception("Exception dispatching packet %s", str(packet))
|
||||
|
||||
|
|
Loading…
Reference in a new issue