Skip to content

Commit

Permalink
Merge pull request #11 from emontnemery/do_not_log_ping_pong
Browse files Browse the repository at this point in the history
Decrease log level to debug for PING/PONG
  • Loading branch information
Johan Bloemberg authored Nov 16, 2018
2 parents 7a496bd + 85411a9 commit 8d4c350
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions rflinkproxy/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ def handle_raw_tx_packet(self, writer, raw_packet):

log.debug(' %s:%s: decoded packet: %s', peer[0], peer[1], packet)
if self.protocol and packet:
log.info(' %s:%s: forwarding packet %s to RFLink', peer[0], peer[1], raw_packet)
if not ';PING;' in raw_packet:
log.info(' %s:%s: forwarding packet %s to RFLink', peer[0], peer[1], raw_packet)
else:
log.debug(' %s:%s: forwarding packet %s to RFLink', peer[0], peer[1], raw_packet)
yield from self.forward_packet(writer, packet, raw_packet)
else:
log.warning(' %s:%s: no valid packet %s', peer[0], peer[1], packet)
Expand Down Expand Up @@ -200,7 +203,10 @@ def client_connected_callback(self, reader, writer):

def raw_callback(self, raw_packet):
"""Send data to all connected clients."""
log.info('forwarding packet %s to clients', raw_packet)
if not ';PONG;' in raw_packet:
log.info('forwarding packet %s to clients', raw_packet)
else:
log.debug('forwarding packet %s to clients', raw_packet)
writers = [i[1] for i in list(clients)]
for writer in writers:
writer.write(str(raw_packet).encode() + CRLF)
Expand Down

0 comments on commit 8d4c350

Please sign in to comment.