MCPcopy
hub / github.com/ray-project/ray / write

Method write

python/ray/serve/_private/logging_utils.py:288–304  ·  view source on GitHub ↗
(self, buf: str)

Source from the content-addressed store, hash-verified

286 return 1
287
288 def write(self, buf: str):
289 temp_linebuf = self._linebuf + buf
290 self._linebuf = ""
291 for line in temp_linebuf.splitlines(True):
292 # From the io.TextIOWrapper docs:
293 # On output, if newline is None, any '\n' characters written
294 # are translated to the system default line separator.
295 # By default sys.stdout.write() expects '\n' newlines and then
296 # translates them so this is still cross-platform.
297 if line[-1] == "\n":
298 self._logger.log(
299 self._log_level,
300 line.rstrip(),
301 stacklevel=self.get_stacklevel(),
302 )
303 else:
304 self._linebuf += line
305
306 def flush(self):
307 if self._linebuf != "":

Callers 6

test_stream_to_loggerFunction · 0.95
_write_if_changedFunction · 0.45
_save_server_stateMethod · 0.45
_send_socket_commandMethod · 0.45

Calls 3

get_stacklevelMethod · 0.95
rstripMethod · 0.80
logMethod · 0.45

Tested by 1

test_stream_to_loggerFunction · 0.76