Skip to main content

Mastra.setLogger()

.setLogger() 方法用于为 Mastra 实例中的所有组件(代理、工作流等)设置日志记录器。此方法接受一个包含 logger 属性的单个对象参数。

🌐 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.

使用示例
Direct link to 使用示例

🌐 Usage example

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

参数
Direct link to 参数

🌐 Parameters

options:

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

选项
Direct link to 选项

🌐 Options

logger:

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

返回
Direct link to 返回

🌐 Returns

此方法不返回值。

🌐 This method does not return a value.

🌐 Related