> ## Documentation Index
> Fetch the complete documentation index at: https://braintrust.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Log user feedback selectively with init_logger

export const plans_0 = "Any"

export const deployments_0 = "Any"

export const data_plane_version_0 = undefined

export const use_case_0 = undefined

<Note>
  **Applies to:**

  * Plan - {plans_0}
  * Deployment - {deployments_0}
  * {data_plane_version_0}
  * {use_case_0}
</Note>

Summary

To minimize costs while collecting user feedback for dataset curation, use `init_logger()` to create a logger instance and only call `logger.log()` when users provide feedback (thumbs up/down). This approach avoids automatic tracing of every interaction and allows manual review before promoting logs to datasets for experiments.

## Configuration Steps

### Step 1: Initialize logger at startup

Create a logger instance at application startup instead of using traced decorators for automatic logging.

```text theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
import braintrust

logger = braintrust.init_logger(project="My App")

```

### Step 2: Log only on feedback events

Call `logger.log()` exclusively when user feedback is received to avoid logging every interaction.

```text theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
def on_feedback(user_input, agent_output, thumbs_up: bool):
    logger.log(
        input=user_input,
        output=agent_output,
        scores={"user_feedback": 1 if thumbs_up else 0},
        tags=["user-feedback"],
    )

```

### Step 3: Review and promote logs

Review logged interactions in the project Logs tab, add additional tags as needed, and promote entries to datasets for running experiments.

## Alternative: Direct Dataset Insertion

### Skip logging layer entirely

For maximum cost savings, insert directly into datasets when feedback is received without using the logging layer.

```text theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
import braintrust

dataset = braintrust.init_dataset(project="My App", name="user-feedback")

def on_feedback(user_input, agent_output, thumbs_up: bool):
    dataset.insert(
        input=user_input,
        expected=agent_output,
        metadata={"feedback": "positive" if thumbs_up else "negative"},
    )

```
