def syslog_tcp(sock, message, priority=0, facility=0): print "syslog_tcp " + message data = SyslogProtocol.encode(facility, priority, message) sock.send(data + '\n')
def syslog_udp(message, priority=0, facility=0, host='127.0.0.1', port=514): sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) print "syslog_udp " + message data = SyslogProtocol.encode(facility, priority, message) sock.sendto(data + '\n', (host, port)) sock.close()