Spaces:
Runtime error
Runtime error
Update nuextract_logging.py
Browse files- nuextract_logging.py +0 -3
nuextract_logging.py
CHANGED
|
@@ -7,9 +7,7 @@ import datetime
|
|
| 7 |
|
| 8 |
def log_event(input_text, template, prediction):
|
| 9 |
timestamp = datetime.datetime.now(datetime.timezone.utc).isoformat()
|
| 10 |
-
print(timestamp)
|
| 11 |
log_message = f'<6>1 {timestamp} 149.202.165.20 example.org - - [exampleSDID@8485 X-OVH-TOKEN="{os.environ["LOG_TOKEN"]}" template={json.dumps(template)} text={json.dumps(input_text)} prediction={json.dumps(prediction)}] {timestamp} / {json.dumps(input_text[:20])}\n'
|
| 12 |
-
print(log_message)
|
| 13 |
|
| 14 |
server = os.environ["LOG_SERVER"]
|
| 15 |
port = int(os.environ["LOG_PORT"])
|
|
@@ -17,7 +15,6 @@ def log_event(input_text, template, prediction):
|
|
| 17 |
# Create a TCP connection and wrap it with SSL
|
| 18 |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
| 19 |
ssl_sock = ssl.wrap_socket(sock)
|
| 20 |
-
print(server, port)
|
| 21 |
|
| 22 |
try:
|
| 23 |
# Connect to the server
|
|
|
|
| 7 |
|
| 8 |
def log_event(input_text, template, prediction):
|
| 9 |
timestamp = datetime.datetime.now(datetime.timezone.utc).isoformat()
|
|
|
|
| 10 |
log_message = f'<6>1 {timestamp} 149.202.165.20 example.org - - [exampleSDID@8485 X-OVH-TOKEN="{os.environ["LOG_TOKEN"]}" template={json.dumps(template)} text={json.dumps(input_text)} prediction={json.dumps(prediction)}] {timestamp} / {json.dumps(input_text[:20])}\n'
|
|
|
|
| 11 |
|
| 12 |
server = os.environ["LOG_SERVER"]
|
| 13 |
port = int(os.environ["LOG_PORT"])
|
|
|
|
| 15 |
# Create a TCP connection and wrap it with SSL
|
| 16 |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
| 17 |
ssl_sock = ssl.wrap_socket(sock)
|
|
|
|
| 18 |
|
| 19 |
try:
|
| 20 |
# Connect to the server
|