Automatic Logging

When the Baserun SDK is initialized explicitly or via our testing plugins, all OpenAI and Anthropic chat and completion requests are automatically logged with no additional code changes. We capture LLM prompts, configuration, and usage. We do this by injecting a very thin wrapper around the client libraries.

Custom logs

In addition to LLM logs, it’s often helpful to debug and understand your workflow by capturing additional information such as other 3rd party API results or interesting business logic. To accomplish this, you can add a custom baserun.log call.

log

Logs a custom message to Baserun. If Baserun is not initialized, this function will have no effect.

message
string

The name of the custom log message to be recorded.

payload
string | object

The log’s additional data, which can be either a string or an object.