first commit

This commit is contained in:
2025-03-24 21:33:34 +00:00
commit 4a183d6f90
34 changed files with 885 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
'''
send a text to the local event-log
usage as library or from the CLI:
python3 addEvent.py "ERROR,key,timeout,count, text"
'''
import sys
import socket
def send_event(text):
'''
text must be a str
'''
host = "localhost"
port = 1234 # The same port as used by the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
s.sendall(bytes(text, 'utf-8'))
# data = s.recv(1024) # nothing should be returned....
s.close()
if __name__ == "__main__":
if len(sys.argv) > 1:
send_event(sys.argv[1].encode('utf-8'))