Skip to main content
Mastra v1 is coming in January 2026. Get ahead by starting new projects with the beta or upgrade your existing project today.

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 exampleDirect link to Usage example

mastra.setLogger({ logger: new PinoLogger({ name: "testLogger" }) });

ParametersDirect link to Parameters

options:

{ logger: TLogger }
An object containing the logger instance to set for all components.

OptionsDirect link to Options

logger:

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

ReturnsDirect link to Returns

This method does not return a value.

On this page