MCPcopy Create free account
hub / github.com/CJackHwang/AIstudioProxyAPI / write

Method write

models/logging.py:17–27  ·  view source on GitHub ↗
(self, buf: str)

Source from the content-addressed store, hash-verified

15 self.linebuf = ""
16
17 def write(self, buf: str):
18 try:
19 temp_linebuf = self.linebuf + buf
20 self.linebuf = ""
21 for line in temp_linebuf.splitlines(True):
22 if line.endswith(("\n", "\r")):
23 self.logger.log(self.log_level, line.rstrip())
24 else:
25 self.linebuf += line
26 except Exception as e:
27 print(f"StreamToLogger Error: {e}", file=sys.__stderr__)
28
29 def flush(self):
30 try:

Calls

no outgoing calls