def _log_message(self, direction, msg):
    'Logs a message being sent or received over the connection.'
    if (direction == 'send'):
        log_message = 'Send message to '
    elif (direction == 'receive'):
        log_message = 'Received message from '
    log_message += ('%s:%d: %s' % (self.dstaddr, self.dstport, repr(msg)[:500]))
    if (len(log_message) > 500):
        log_message += '... (msg truncated)'
    logger.debug(log_message)
Logs a message being sent or received over the connection.
def _log_message(self, direction, msg):
    
    if (direction == 'send'):
        log_message = 'Send message to '
    elif (direction == 'receive'):
        log_message = 'Received message from '
    log_message += ('%s:%d: %s' % (self.dstaddr, self.dstport, repr(msg)[:500]))
    if (len(log_message) > 500):
        log_message += '... (msg truncated)'
    logger.debug(log_message)