Send a syslog message to remote host using UDP or TCP

def send(self, message, level=Level.NOTICE):
    "Send a syslog message to remote host using UDP or TCP"
    data = "<%d>%s" % (level + self.facility*8, message)
    if self.protocol == 'UDP':
        self.socket.sendto(data.encode('utf-8'), (self.host, self.port))
    else:
        self.socket.send(data.encode('utf-8'))