def handle(self, data): logdata = ray_client_pb2.LogData() logdata.level = -2 if data["is_err"] else -1 logdata.name = "stderr" if data["is_err"] else "stdout" with io.StringIO() as file: print_worker_logs(data, file) logdata.msg = file.getvalue() self.queue.put(logdata)
def emit(self, record: logging.LogRecord): logdata = ray_client_pb2.LogData() logdata.msg = record.getMessage() logdata.level = record.levelno logdata.name = record.name self.queue.put(logdata)