Support remote logging

This commit is contained in:
Ruben van de Ven 2023-10-12 09:03:11 +02:00
parent ee57604b30
commit ffcf1c26c1

View file

@ -1,4 +1,5 @@
import logging import logging
from logging.handlers import SocketHandler
from multiprocessing import Process, Queue from multiprocessing import Process, Queue
from trajpred.config import parser from trajpred.config import parser
from trajpred.prediction_server import InferenceServer, run_inference_server from trajpred.prediction_server import InferenceServer, run_inference_server
@ -14,6 +15,13 @@ def start():
level=loglevel, level=loglevel,
) )
if args.remote_log_addr:
logging.captureWarnings(True)
root_logger = logging.getLogger()
root_logger.setLevel(logging.NOTSET) # to send all records to cutelog
socket_handler = SocketHandler(args.remote_log_addr, args.remote_log_port)
root_logger.addHandler(socket_handler)
# instantiating process with arguments # instantiating process with arguments
procs = [ procs = [
Process(target=run_ws_forwarder, args=(args,)) Process(target=run_ws_forwarder, args=(args,))