> Discover all available pages from the documentation index: https://mastra.ai/llms.txt

# Logger

Mastra sets the project's [logger](https://mastra.ai/docs/observability/logging) from a `logger.ts` file directly under `src/mastra/`. The file default-exports a logger, which replaces the built-in `ConsoleLogger` used across agents, workflows, and other components.

Use this page for the file-based convention. For log levels, transports, and provider details, see [logging](https://mastra.ai/docs/observability/logging).

## Quickstart

Create `src/mastra/logger.ts` and default-export a logger, such as [`PinoLogger`](https://mastra.ai/reference/logging/pino-logger):

```typescript
import { PinoLogger } from '@mastra/loggers'

export default new PinoLogger({
  name: 'Mastra',
  level: 'info',
})
```

Mastra registers the logger before storage, observability, and file-based agents, so those primitives log through this logger as they are wired up.

## Precedence with code

Code-registered logging wins over `logger.ts`. If you pass `logger` to `new Mastra({ logger })` in `src/mastra/index.ts` (or set `logger: false` to disable logging), `logger.ts` is ignored with a warning. Use `logger.ts` when one project-wide logger is enough; use code registration when setup depends on runtime wiring.