# Mastra.setLogger()

The `.setLogger()` method is used to set the logger for all components (agents, workflows, etc.) in the Mastra instance. This method accepts a single object parameter with a logger property.

## Usage example

```typescript
mastra.setLogger({ logger: new PinoLogger({ name: 'testLogger' }) })
```

## Parameters

**options** (`{ logger: TLogger }`): An object containing the logger instance to set for all components.

**options.logger** (`TLogger`): The logger instance to set for all components (agents, workflows, etc.).

## Returns

This method doesn't return a value.

## Related

- [Logging overview](https://mastra.ai/docs/observability/logging)
- [Logger reference](https://mastra.ai/reference/logging/pino-logger)