Logging

The log() method sends messages to users and logs locally. This is designed to be a unified logging interface to reduce the need of managing separate logs for the developer and front end users.

Signature

async log(
  message: string | object | any[],
  options?: { error?: boolean; debug?: boolean }
): Promise<LogResponse>

Parameters

  • message: String, object, array, or Pydantic model to log

  • error (optional): If true, log as error level

  • debug (optional): If true, only log to console (skip backend)

Response

Returns LogResponse:

  • success (boolean): Whether the log was sent

  • error (string | null): Error message if sending failed

Examples

Notes

  • To ensure a good user experience, make sure that any logs which do not have debug=True are clean and concise.

  • Objects are pretty-printed in console, serialized for backend

Last updated