MCPcopy Create free account
hub / github.com/vercel/vercel / write

Method write

python/vercel-runtime/src/vercel_runtime/vc_init.py:217–247  ·  view source on GitHub ↗
(self, message: str)

Source from the content-addressed store, hash-verified

215 self.stream_name = stream_name
216
217 def write(self, message: str) -> None:
218 context = storage.get()
219 if context is not None:
220 send_message(
221 {
222 "type": "log",
223 "payload": {
224 "context": {
225 "invocationId": context["invocationId"],
226 "requestId": context["requestId"],
227 },
228 "message": base64.b64encode(
229 message.encode()
230 ).decode(),
231 "stream": self.stream_name,
232 },
233 }
234 )
235 else:
236 enqueue_or_send_message(
237 {
238 "type": "log",
239 "payload": {
240 "context": {"invocationId": "0", "requestId": 0},
241 "message": base64.b64encode(
242 message.encode()
243 ).decode(),
244 "stream": self.stream_name,
245 },
246 }
247 )
248
249 def __getattr__(self, name: str) -> Any:
250 return getattr(self.stream, name)

Callers 11

_stderrFunction · 0.45
wrapperFunction · 0.45
enqueue_or_send_messageFunction · 0.45
vc_init.pyFile · 0.45
log_messageMethod · 0.45
handle_requestMethod · 0.45
_invoke_lambdaFunction · 0.45
do_GETMethod · 0.45
do_POSTMethod · 0.45
lambda_invoke.pyFile · 0.45
do_GETMethod · 0.45

Calls 5

send_messageFunction · 0.85
enqueue_or_send_messageFunction · 0.85
decodeMethod · 0.80
getMethod · 0.65
encodeMethod · 0.45

Tested by 1

_invoke_lambdaFunction · 0.36