From e6fbab30aacb8cc746e28442d62f29f7029abc21 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Mon, 8 Oct 2018 17:44:02 -0400 Subject: [PATCH] logging --- aioupnp/protocols/ssdp.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/aioupnp/protocols/ssdp.py b/aioupnp/protocols/ssdp.py index bd793ac..9573726 100644 --- a/aioupnp/protocols/ssdp.py +++ b/aioupnp/protocols/ssdp.py @@ -31,6 +31,7 @@ class SSDPProtocol(MulticastProtocol): SSDPDatagram._M_SEARCH, host="{}:{}".format(SSDP_IP_ADDRESS, SSDP_PORT), st=service, man=SSDP_DISCOVER, mx=1 ) + log.debug("sending packet to %s:%i: %s", address, SSDP_PORT, packet) self.transport.sendto(packet.encode().encode(), (address, SSDP_PORT)) f: Future = Future() self.discover_callbacks[(address, service)] = f @@ -41,15 +42,15 @@ class SSDPProtocol(MulticastProtocol): return try: packet = SSDPDatagram.decode(data) - log.debug("decoded %s from %s:%i:\n%s", packet.get_friendly_name(), addr[0], addr[1], packet.encode()) + log.debug("decoded packet from %s:%i: %s", addr[0], addr[1], packet) except UPnPError as err: - log.error("failed to decode SSDP packet from %s:%i: %s\npacket: %s", addr[0], addr[1], err, + log.error("failed to decode SSDP packet from %s:%i (%s): %s", addr[0], addr[1], err, binascii.hexlify(data)) return if packet._packet_type == packet._OK: - log.debug("%s:%i sent us an OK", addr[0], addr[1]) if (addr[0], packet.st) in self.discover_callbacks: + log.debug("%s:%i replied to our m-search", addr[0], addr[1]) if packet.st not in map(lambda p: p['st'], self.replies): self.replies.append(packet) ok_fut: Future = self.discover_callbacks.pop((addr[0], packet.st))